Git合并似乎会导致代码在文件中重复两次的冲突

Git合并似乎会导致代码在文件中重复两次的冲突,git,merge,Git,Merge,我正在将我的主分支合并到我的电子邮件分支中,但遇到合并冲突,即使有几行相互冲突,文件的大部分都被复制。我在电子邮件分支上运行的命令是git merge master。例如,conflicted.gitignore以当前更改开始: +<<<<<<< HEAD 1 ## Ignore Visual Studio temporary files, build results, and 2 ## files generated by popular Visual

我正在将我的主分支合并到我的电子邮件分支中,但遇到合并冲突,即使有几行相互冲突,文件的大部分都被复制。我在电子邮件分支上运行的命令是git merge master。例如,conflicted.gitignore以当前更改开始:

+<<<<<<< HEAD
1 ## Ignore Visual Studio temporary files, build results, and
2 ## files generated by popular Visual Studio add-ons.
3 
4 # User-specific files
5 *.suo
6 *.user
7 *.userosscache
8 *.sln.docstates
9
10 # User-specific files (MonoDevelop/Xamarin Studio)
11 *.userprefs
12 
13 # Build results
14 [Dd]ebug/
15 [Dd]ebugPublic/
16 [Rr]elease/
17 [Rr]eleases/
18 [Xx]64/
19 [Xx]86/
20 [Bb]uild/
21 bld/
22 [Bb]in/
23 [Oo]bj/
24 MyProject/MyProject.Tests/bin/ // this is new, this is where the conflict should be?
25 MyProject/MyProject.Tests/obj/
26 
27 # Visual Studio 2015 cache/options directory
28 .vs/
所以基本上我所有的改变都在上面,然后我的合作者所有的改变都在下面。我认为这可能是一个行尾的事情,但它似乎并不可怕。为什么这些代码都是重复的?合并是一件痛苦的事情,当它是这样并且似乎发生在每个有冲突的文件上时。如果需要包含更多信息,请告诉我。

:


我的测试是否是行尾问题的天真方法最初不起作用,但使用git config-global core.autocrlf true设置行确实起作用


是什么让你认为这不是一个行尾问题?因为这也是我的第一个想法。或者,在每一行的末尾都可以有额外的空白。您可能希望查看通过将merge.conflictStyle设置为diff3进行合并而生成的结果,以便查看Git认为基本版本中的原始文本是什么。但在这种情况下,它确实看起来像是行尾问题。我的测试行尾问题的天真方法最初不起作用,但使用git config-global core.autocrlf true设置行确实起作用,谢谢。
259 =======
260 ## Ignore Visual Studio temporary files, build results, and
261 ## files generated by popular Visual Studio add-ons.
262 
263 # User-specific files
264 *.suo
265 *.user
266 *.userosscache
267 *.sln.docstates
268 
269 # User-specific files (MonoDevelop/Xamarin Studio)
270 *.userprefs
271 
272 # Build results
273 [Dd]ebug/
274 [Dd]ebugPublic/
275 [Rr]elease/
276 [Rr]eleases/
277 [Xx]64/
278 [Xx]86/
279 [Bb]uild/
280 bld/
281 [Bb]in/
282 [Oo]bj/
283 
284 # Visual Studio 2015 cache/options directory
285 .vs/