Git:如何获取 git 存储库的快照

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/615816/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 06:14:20  来源:igfitidea点击:

Git : How to get a snapshot of a git repository

gitarchivesnapshot

提问by claf

I'm looking for the right way to get an archive of a git repository without the .git/ directory in order to send a daily snapshot to testers.

我正在寻找正确的方法来获取没有 .git/ 目录的 git 存储库的存档,以便向测试人员发送每日快照。

回答by jonnii

git archive HEAD --format=zip > archive.zip

This does what it says on the tin.

这就是它在锡上所说的。

More info here: http://gitready.com/intermediate/2009/01/29/exporting-your-repository.html

更多信息:http: //gitready.com/intermediate/2009/01/29/exporting-your-repository.html

回答by blueyed

This will result in archive.tar.gz and add a prefix dir named "prefix-dir":

这将导致 archive.tar.gz 并添加一个名为“prefix-dir”的前缀目录:

git archive --prefix=prefix-dir/ -o archive.tar HEAD
gzip archive.tar