假设我们有 2 个开发分支(master和feature),并且两个分支都将一些代码添加到同一个文件中。当试图合并时,feature我们master遇到了一个单一的冲突:
++<<<<<<< HEAD
+ //some code added in master branch
++=======
+ //some code added in feature branch
++>>>>>>> feature
如果我只想接受HEAD(主人)并放弃,feature我会运行:
git checkout --ours path/to/file
如果我只想接受feature(主人)并放弃,HEAD我会运行:
git checkout --theirs path/to/file
我怎样才能接受这两种更改,以便解决冲突的结果就像代码的简单联合?
//some code added in master branch
//some code added in feature branch