简体   繁体   English

如何将git存储库转换为可以应用补丁的单个.diff文件

[英]How to turn a git repository into a single .diff file that can be applied with patch

I have multiple git repositories and would like to generate a big .diff file for each repository. 我有多个git存储库,并希望为每个存储库生成一个大的.diff文件。

This .diff patch would then be applied by a customer using something like the 'patch' utility to generate the files in the repository minus git history. 然后,客户使用类似“patch”实用程序的东西来应用此.diff补丁,以生成存储库中的文件减去git历史记录。

Does anyone know how I would be able to do this? 有谁知道我怎么能这样做?

Thanks for your time, Matt 谢谢你的时间,马特

If you want to diff against nothing...why not just do that? 如果你想反对任何事情......为什么不这样做呢?

$ mkdir empty
$ ls
empty myproject
$ diff -ruN empty myproject > diff-against-nothing.patch

git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904> diff-against-nothing.patch我发现了git的魔法空SHA1!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM