为特定的提交生成一个git补丁 [英] Generate a git patch for a specific commit

查看:93
本文介绍了为特定的提交生成一个git补丁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我试着使用 git format-patch< p> SHA1> ,但自那个SHA1开始,每次提交都会生成一个补丁。在生成了几百个补丁后,我不得不杀死这个进程。



有没有办法为特定的SHA1生成补丁?

解决方案

试试:

  git  format-patch  -1< sha> 

  git format-patch -1 HEAD 

使用以下命令应用修补程序:

  patch -p1< file.patch 


I need to write a script that create patches for a list of SHA1 commit numbers.

I tried using git format-patch <the SHA1>, but that generated a patch for each commit since that SHA1. After a few hundred patches were generated, I had to kill the process.

Is there a way to generate a patch only for the specific SHA1?

解决方案

Try:

git format-patch -1 <sha>

or

git format-patch -1 HEAD

Apply the patch with the command:

patch -p1 < file.patch

这篇关于为特定的提交生成一个git补丁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆