【发布时间】:2015-10-15 19:52:20
【问题描述】:
我以下面的例子来问一个我在工作中遇到的合并冲突问题。
假设我在master分支中有一个名为mainFile.txt的文件,其内容为:
1 this is the first line in master branch
2 this is the second line in master branch
3 this is the third line in master branch
从 master 分支,我创建了两个分支:branchA 和 branchB,每个分支都有新行(从两个分支的第 4 行开始)添加到同一个 mainFile.txt 文件中:
branchA中mainFile.txt的内容:
1 this is the first line in master branch
2 this is the second line in master branch
3 this is the third line in master branch
4 This is the fourth line in branchA
5 this is the fifth line in branchA
branchB中mainFile.txt的内容:
1 this is the first line in master branch
2 this is the second line in master branch
3 this is the third line in master branch
4 This is the fourth line in branchB
5 This is the fifth line in branchB
6 This is the sixth line in branchB
现在,我需要将两个分支合并回 master。当我先将branchA合并到master时没有问题。但是,当我将 branchB 合并到 master 时,会出现合并冲突。从以下附加的合并冲突屏幕截图中,我需要保留 branchA 和 branchB 中的所有行。我想知道如何解决合并冲突。我一直在尝试使用 vimdiff,但在我看来,我需要决定保留任一分支(而不是两者)。
【问题讨论】:
标签: git version-control merge conflict