Reputation: 405
I am merging my master
branch into my email
branch but am running into merge conflicts where, even though there are a few lines that conflict with each other, large parts of the file are being duplicated. The command I am running is git merge master
while I'm on the email
branch. For example, the conflicted .gitignore
starts out with the current changes:
+<<<<<<< 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/
And then, after finishing the entirety of the file, the incoming changes start at line 259, where it largely is the same code, repeated:
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/
So it basically seems like ALL of my changes are on the top, and then ALL of my collaborator's changes are on the bottom. I thought this could be a line ending thing but it doesn't appear to be AFAICT. Why is all this code duplicating? It is a pain to merge when it is like this and seems to be happening to every file with a conflict. Please let me know if I need to include any more information.
Upvotes: 0
Views: 109
Reputation: 25895
My naive approach to test if it was a line ending problem didn't work originally but setting the lines with
git config --global core.autocrlf true
did indeed work
Upvotes: 1