Probably the simplest way to achieve this is with git archive
.
(可能最简单的方法是使用git archive
。)
If you really need just the expanded tree you can do something like this. (如果您真的只需要扩展树,则可以执行以下操作。)
git archive master | tar -x -C /somewhere/else
Most of the time that I need to 'export' something from git, I want a compressed archive in any case so I do something like this.
(在大多数情况下,我需要从git中“导出”某些内容,无论如何我都想要压缩的存档,所以我要做类似的事情。)
git archive master | bzip2 >source-tree.tar.bz2
ZIP archive:
(ZIP存档:)
git archive --format zip --output /full/path/to/zipfile.zip master
git help archive
for more details, it's quite flexible.
(git help archive
以获取更多详细信息,它非常灵活。)
Be aware that even though the archive will not contain the .git directory, it will, however, contain other hidden git-specific files like .gitignore, .gitattributes, etc. If you don't want them in the archive, make sure you use the export-ignore attribute in a .gitattributes file and commit this before doing your archive.
(请注意,即使存档中不包含.git目录,但该存档中也会包含其他特定于git的隐藏文件,例如.gitignore,.gitattributes等。如果您不希望它们出现在存档中,请确保请在.gitattributes文件中使用export-ignore属性,并在进行归档之前提交。)
Read more... (阅读更多...)
Note: If you are interested in exporting the index, the command is
(注意:如果您有兴趣导出索引,则命??令为)
git checkout-index -a -f --prefix=/destination/path/
(See Greg's answer for more details)
((有关更多详细信息,请参见格雷格的答案 ))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…