【发布时间】:2011-02-05 00:56:50
【问题描述】:
我有一个文件,里面只有一行。 我创建了一个分支并将第二行添加到同一个文件中。保存并提交到分支。 我切换回主人。并在文件中添加不同的第二行。保存并提交给主人。 所以现在总共有 3 条独特的线路。
如果我现在尝试将分支合并回主分支,则会发生合并冲突。
为什么 Git 不能一个接一个地简单地合并每一行?
我的合并尝试是这样的:
PS D:\dev\testing\test1> git merge newbranch
Auto-merging hello.txt
CONFLICT (content): Merge conflict in hello.txt
Automatic merge failed; fix conflicts and then commit the result.
PS D:\dev\testing\test1> git diff
diff --cc hello.txt
index 726eeaf,e48d31a..0000000
--- a/hello.txt
+++ b/hello.txt
@@@ -1,2 -1,2 +1,6 @@@
This is the first line.
- New line added by master.
-Added a line in newbranch.
++<<<<<<< HEAD
++New line added by master.
++=======
++Added a line in newbranch.
++>>>>>>> newbranch
有没有办法让它一个接一个地自动插入?
【问题讨论】:
-
似乎没有一种简单的方法来确定它们应该被插入的顺序 - 毕竟,在可执行代码方面,顺序当然很重要。
标签: git