如何使用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

posted @ 2018-05-31 12:03  夏海风  阅读(4972)  评论(0编辑  收藏  举报