Do a “git export” (like “svn export”)?

后端 未结 30 2879
暖寄归人
暖寄归人 2020-11-21 22:33

I\'ve been wondering whether there is a good \"git export\" solution that creates a copy of a tree without the .git repository directory. There are at least thr

30条回答
  •  盖世英雄少女心
    2020-11-21 23:01

    I have hit this page frequently when looking for a way to export a git repository. My answer to this question considers three properties that svn export has by design compared to git, since svn follows a centralized repository approach:

    • It minimizes the traffic to a remote repository location by not exporting all revisions
    • It does not include meta information in the export directory
    • Exporting a certain branch using svn is accomplished by specifying the appropriate path

      git clone --depth 1 --branch master git://git.somewhere destination_path
      rm -rf destination_path/.git
      

    When building a certain release it is useful to clone a stable branch as for example --branch stable or --branch release/0.9.

提交回复
热议问题