如何使用git 生成patch 和打入patch


https://blog.csdn.net/liuhaomatou/article/details/54410361
https://www.jianshu.com/p/e5d801b936b6

1. patch

git format-patch --commit
git format-patche 795fefabc

2. appy

先檢查patch文件:git apply --stat newpatch.patch
檢查能否應用成功:git apply --check newpatch.patch
打補丁:git am --signoff < newpatch.patch (使用-s或--signoff選項,可以commit信息中加入Signed-off-by信息)
git apply --reject --ignore-whitespace ~/patch/patch/test.diff 2>&1 | tee ~/patch/patch/testdiff.log``
gnore-whitespace是忽略多余的空格。
在使用git am之前, 你要首先git am --abort 一次,來放棄掉以前的am信息,這樣才可以進行一次全新的am。

3 沖突解決:

git apply --reject PATCH
$ edit edit edit
(譯注:根據.rej文件手動解決所有沖突)
找到文件改成 -

$ git add FIXED_FILES
$ git am --continue


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM