1.合入遇到冲突
$ git am 0001-net-dsa-mv88e6xxx-Fix-statistics-on-mv88e6161.patch
Applying: net: dsa: mv88e6xxx: Fix statistics on mv88e6161
error: patch failed: drivers/net/dsa/mv88e6xxx/chip.c:3093
error: drivers/net/dsa/mv88e6xxx/chip.c: patch does not apply
Patch failed at 0001 net: dsa: mv88e6xxx: Fix statistics on mv88e6161
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
如上提示“patch does not apply”,说明patch不能合入,你可以解决问题后“git am --continue”继续,也可以“git am --skip”忽略,或者“git am --abort”停止合入。
2.git apply --reject导出冲突
$ git apply --reject 0001-net-dsa-mv88e6xxx-Fix-statistics-on-mv88e6161.patch
Checking patch drivers/net/dsa/mv88e6xxx/chip.c...
error: while searching for:
.port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
.port_link_state = mv88e6352_port_link_state,
.port_get_cmode = mv88e6185_port_get_cmode,
.stats_snapshot = mv88e6320_g1_stats_snapshot,
.stats_set_histogram = mv88e6095_g1_stats_set_histogram,
.stats_get_sset_count = mv88e6095_stats_get_sset_count,
.stats_get_strings = mv88e6095_stats_get_strings,
此时git status会看到.rej结尾的文件,此文件即表示希望合入的代码。
3.vim -O打开此文件和原文件
此时掌握几个命令:
ctrl+双w:左右界面切换;
/+字符串:在此文件搜索字符串匹配
shift+v:全选行;
shift+v,上下键:选多行
y:复制
p:粘贴
dd:删除行
活用如上快捷键,可实现从左侧粘贴对应内容,并复制到右侧文件,同时删除想要删除行;
1)光标指向左侧文件+行,shift+v选中,y复制;
2)ctrl+ww到右侧文件,光标指向对应修改行,p粘贴;
3)光标指向希望删除行,dd删除;
4)保存文件;
网友评论