问题:
I've been wondering whether there is a good "git export" solution that creates a copy of a tree without the .git
repository directory. 我一直在想是否有一个好的“ git export”解决方案来创建没有.git
存储库目录的树的副本。 There are at least three methods I know of: 我至少知道三种方法:
-
git clone
followed by removing the.git
repository directory.git clone
然后删除.git
存储库目录。 -
git checkout-index
alludes to this functionality but starts with "Just read the desired tree into the index..." which I'm not entirely sure how to do.git checkout-index
暗示了此功能,但以“只需将所需的树读入索引...”开头,我不确定该怎么做。 -
git-export
is a third party script that essentially does agit clone
into a temporary location followed byrsync --exclude='.git'
into the final destination.git-export
是第三方脚本,其本质上是将git clone
到临时位置,然后将rsync --exclude='.git'
git clone
到最终目标位置。
None of these solutions really strike me as being satisfactory. 这些解决方案都没有使我感到满意。 The closest one to svn export
might be option 1, because both those require the target directory to be empty first. 最接近svn export
选项可能是选项1,因为这两个选项均要求目标目录首先为空。 But option 2 seems even better, assuming I can figure out what it means to read a tree into the index. 但是,假设我能弄清楚将树读入索引的含义,选项2似乎更好。
解决方案:
参考一: https://stackoom.com/question/fmS/是否进行-git导出-如-svn导出参考二: https://oldbug.net/q/fmS/Do-a-git-export-like-svn-export
来源:oschina
链接:https://my.oschina.net/u/4432649/blog/4463028