When merging branches in a version control system, a merge conflict might arise. This tag is for questions about how such conflicts can be resolved.
Questions tagged [merge-conflict-resolution]
755 questions
56
votes
8 answers
How to avoid git conflicts in a team?
We are some developers who work on same project and we use git for the project. If two or more of us happen to work on same file, we receive git conflicts which are hard to deal with, sometimes changes done by one developer are lost when these…

Dev01
- 4,082
- 5
- 29
- 45
51
votes
1 answer
Navigate to next conflict with vimdiff
In vimdiff you can use [c and ]c to go to the previous or next change, but when doing three-way merging many of those changes are not conflicts. Is there a command to go to the next conflict, not the next change as in e.g. Kaleidoscope?

Andreas Järliden
- 1,884
- 1
- 17
- 16
45
votes
4 answers
Jump to next error / code highlighted in red
When dealing with merge conflicts it is common that the >>>>>> and ====== inserted by DCVS are syntactically incorrect for the file I'm in and show up as highlighted in red. When dealing with merge conflicts it would be useful to have commands to…

Andy Ray
- 30,372
- 14
- 101
- 138
45
votes
4 answers
Troubles with git and Gemfile.lock
I keep running into the following error with my Gemfile.lock whenever I want to do a git pull or checkout a new branch.
error: Your local changes to the following files would be overwritten by merge:
Gemfile.lock
Please, commit your changes or…

grautur
- 29,955
- 34
- 93
- 128
39
votes
1 answer
Git conflict (rename/rename)
After merging branched I've received a conflict (rename/rename) on bunch of files, with file~HEAD, and file~my_test_branch created. How to resolve these?
Thanks

spacemonkey
- 19,664
- 14
- 42
- 62
35
votes
5 answers
Visual Studio 2013 does not offer to do merge on Git pull
I'm working with Visual Studio 2013 Update 4 and git (hosted on Visual Studio Online). I have 2 local commits and 2 commits in remote branch. There are NO local changes to commit:
When I try to do Pull (or Fetch) in Visual Studio, I get error:
An…

trailmax
- 34,305
- 22
- 140
- 234
34
votes
6 answers
`git stash` during a merge conflict
We've done something bad.
We ran git stash save during a merge conflict, and now we can't restore our work.
Things we've tried:
git pull -Xours origin master
git stash apply --index
And:
git pull origin master
git stash save --keep-index "merge…

steven_moy
- 341
- 1
- 3
- 3
33
votes
3 answers
Resolved git merge conflict in VS Code, but still says unresolved
So I have a develop branch and topic branch. I'm using the default Terminal in Window's VS Code. While in the topic branch, I did git merge develop since I just got latest on develop branch. Now there's a simple merge conflict in one file. In VS…

midnightnoir
- 671
- 2
- 9
- 16
30
votes
3 answers
Cleaning up after a conflicted git merge?
I had a small conflict in a .h header file in a project I'm working on. This project is tracked in Git.
Fortunately, the conflict was very simple to solve. I used
git mergetool
And chose the default (opendiff) which seemed to be FileMerge on my Mac.…

Craig Otis
- 31,257
- 32
- 136
- 234
29
votes
1 answer
How to make a Git merge operation ignore identical changes made to both branches?
Lets assume that we have one development branch 'A', and two sub branches 'B1' and 'B2', (both taken from A). Lets say that you run a format code command (in our case ReSharper's cleanup code) on the entire project in B1 and B2.
Now, when we try to…

Emil G
- 1,211
- 1
- 14
- 26
28
votes
4 answers
How does Git decide on conflicts?
When I pull from GitHub when someone else on the team modified a certain file, Git command shows that there are Unresolved Conflicts that Git couldn't fix. I open Perforce or Visual Studio 2012 to fix the conflicts and the graphical tools shows me…

Tamim Al Manaseer
- 3,554
- 3
- 24
- 33
28
votes
2 answers
Sharing rerere cache
I've seen people recommend that all developers set up a symlink on their machine from C:\project\.git\rr-cache to a shared folder \\server\rr-cache.
However, it would seem more convenient to share the folder by including it in the git repository…
user479911
27
votes
5 answers
prevent file with merge conflicts from getting committed in git
Is there any way of preventing files with merge conflict from getting committed in git? No one is going to commit files with conflict intentionally. But is there a way to prevent files from getting committed in git?
Does git have any settings or…

user3586664
- 397
- 1
- 4
- 12
27
votes
4 answers
Git merging hotfix to multiple branches
I've been trying to wrap my head around git branching models. I've been looking at http://nvie.com/posts/a-successful-git-branching-model/ for some ideas and coming from Subversion one thing I was really looking forward to was making a change in a…

Chuck M
- 1,175
- 3
- 17
- 26
25
votes
3 answers
git - Same file added by both branches causes weird merge conflict
I currently have two branches I am working on. Because of a software update I had to completly change the folder structre. Therefore I moves the files in both branches. Now I reached a point where I want to merge my working branch into my master…

BrainStone
- 3,028
- 6
- 32
- 59