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

后端 未结 30 2886
暖寄归人
暖寄归人 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 22:46

    git archive also works with remote repository.

    git archive --format=tar \
    --remote=ssh://remote_server/remote_repository master | tar -xf -
    

    To export particular path inside the repo add as many paths as you wish as last argument to git, e.g.:

    git archive --format=tar \
    --remote=ssh://remote_server/remote_repository master path1/ path2/ | tar -xv
    

提交回复
热议问题