git生成patch


一、通过git diff 命令生成patch文件
1.还未提交的修改
git diff > commit.patch
2.已提交的修改
git diff 3da71ca35 8b5100cdcd > commit.patch
注)3da71ca35 在8b5100cdcd 前面
如果是只想回退一个commit,可以git diff 3da71ca35^ 3da71ca35 > commit.patch
3.已经add但是未commit的修改
git diff --cached > commit.patch
4.检查patch是否可以应用
git apply --check commit.patch
5.打补丁
git apply commit.patch


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM