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

后端 未结 30 2887
暖寄归人
暖寄归人 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

    As I understand the question, it it more about downloading just certain state from the server, without history, and without data of other branches, rather than extracting a state from a local repository (as many anwsers here do).

    That can be done like this:

    git clone -b someBranch --depth 1 --single-branch git://somewhere.com/repo.git \
    && rm -rf repo/.git/
    
    • --single-branch is available since Git 1.7.10 (April 2012).
    • --depth is (was?) reportedly faulty, but for the case of an export, the mentioned issues should not matter.

提交回复
热议问题