Android 使用git合入修改patch

生成patch

git format-patch -1 commitid


合入patch

git am 0001-.patch


解决合入patch冲突

1. git apply --reject 0001-.patch (强制把不冲突的文件先合并,有冲突的会生成.rej文件)

2..根据.rej这个文件中的修改去手动执行即可 ,解决完冲突要把.rej文件删除

3.git add

4.git am --continue



Patch其他命令使用说明

1.生成patch命令拓展

生成最近的1次commit的patch

git format-patch HEAD^


生成最近的2次commit的patch

git format-patch HEAD^^


生成最近的3次commit的patch

git format-patch HEAD^^^


生成两个commit间的修改的patch(包含两个commit. 都是具体的commit号)

git format-patch ..


生成单个commit的patch

git format-patch -1


生成某commit以来的修改patch(不包含该commit)

git format-patch


生成从根到r1提交的所有patch

git format-patch --root



2.合入patch命令拓展

将名字为0001-.patch的patch打上

git am 0001-.patch


添加-s或者--signoff,还可以把自己的名字添加为signed off by信息,作用是注明打patch的人是谁,因为有时打patch的人并不是patch的作者

git am --signoff 0001-.patch


将路径~/patch-set/*.patch 按照先后顺序打上去

git am ~/patch-set/*.patch


当git am失败时,用以将已经在am过程中打上的patch废弃掉(比如有三个patch,打到第三个patch时有冲突,那么这条命令会把打上的前两个patch丢弃掉,返回没有打patch的状态)

git am --abort


当git am失败,解决完冲突后,这条命令会接着打patch

git am --resolved


查看patch的情况

git apply --stat 0001-.patch


检查patch是否能够打上,如果没有任何输出,则说明无冲突,可以打上

git apply --check 0001-.patch

Android   git   patch
发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章