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
6
votes
3 answers
Find the diff chunks without p4 resolve
I want to design a shell script that will take the resolve decision based on the diff chunks shown by 'p4 resolve'
The current state of my script is something like -
p4 integ -b @=CL #This will open the files in my default CL.
p4 resolve …

Manish Sharma
- 173
- 10
5
votes
1 answer
Why does git sometimes mark added lines as changed lines (i.e. an empty conflict over an added piece of code)
I still don't have a confirmed way to reproduce this but in case this is some well known issue, I'll ask it anyway. What happens is that git often creates conflicts like this:
<<<<<<< HEAD
} // action_do_add
=======
} // action_do_add
...lots of…

Eugene
- 4,197
- 7
- 37
- 54
5
votes
2 answers
Best Practices for Git Merge between different versions
Imagine we use Gitflow where we have split a release branch from develop that will eventually be merged into both main and develop.
On release there are only quality improvements.
Most of these require a deployment to an integration stage, so their…

Lynax
- 117
- 1
- 11
5
votes
3 answers
Overwrite master with develop
Some how in our project our master branch has completely broken. It thinks it's ahead by a few commits, and if we try merging develop in it shows huge amounts of conflicts. It's been broken for a long time now so a lot has happened in develop (too…

CaribouCode
- 13,998
- 28
- 102
- 174
5
votes
2 answers
how to fix merge conflicts before merging
When I try to merge a feature branch into master, I get a merge conflict every now and then.
Now the obvious solution is to just manually resolve the conflict during the merge.
However, with pull-request based workflows (github, gitlab,...), this is…

umläute
- 28,885
- 9
- 68
- 122
5
votes
2 answers
How to ignore merge conflict?
I have next merge conflict:
<<<<<<< Updated upstream
my( $c, $name ) = (shift,shift);
my %name = defined $name ? ( name => $name ) : ();
||||||| merged common ancestors
my( $c ) = shift;
=======
my( $c, $name ) = (shift,shift);
…

Eugen Konkov
- 22,193
- 17
- 108
- 158
5
votes
3 answers
Git: Open merge tool without conflict
I have problems with a merge, but git doesn't mark the file as conflicted.
When I try to open the file with git mergetool, git just says: No files need merging.
How can I open a file without merge conflict in a three way compare?

Thomas Klier
- 449
- 4
- 16
5
votes
2 answers
git merge conflict saying deleted, but it's not
I'm trying to resolve a conflict in a git merge (git version 2.9) - the conflict is suggesting the file in the 'other' branch is deleted, but it's not. Here's a (fairly) short reproducible recipe:
cd /some/new/folder/somewhere
git init
echo 'a on…

Steve Folly
- 8,327
- 9
- 52
- 63
5
votes
2 answers
Mercurial, conflict, merging, further conflicts later on, does Mercurial remember initial resolution?
Imagine this scenario:
Alice and Bob both clones a central master Mercurial repository, containing 1 text file
Both Alice and Bob makes a change to the same line in the file, and commits
Bob pushes back to the central repository, but not…

Lasse V. Karlsen
- 380,855
- 102
- 628
- 825
5
votes
2 answers
resolving conflicts an push reproduce same conflicts again
So I worked all day on a new feature in my project and after I finished it, I wanted to upload my local commits into the repository.
When I tried to push my commits to the git repository, that push was rejected because of some merge conflicts. So I…

Tekay37
- 467
- 5
- 18
5
votes
1 answer
Git Merge - Binary File Conflict Resolution
How do I resolve a binary file conflict resolution during a merge operation in git? Here's what I've done so far:
git checkout master
git fetch origin
git merge working_branch
... [Conflicts] ...
git status
...
Unmerged paths:
both…

Jim Fell
- 13,750
- 36
- 127
- 202
5
votes
1 answer
git merge conflict due to moved files
I have not done so much with git so far. Now, I have the following problem.
While I did some local modifications and commits, my colleague restructured files and folders within a new branch. Then, I added a remote tracking branch (reflecting his…

Antje Janosch
- 1,154
- 5
- 19
- 37
5
votes
3 answers
Automatically resolve git conflicts where possible
We have a .NET solution file with 50+ projects in it, and we have a situation that comes up every so often: two people will make a relatively minor change (such as updating a Nuget package or renaming a file) that affects all 50 project files.
This…

Richiban
- 5,569
- 3
- 30
- 42
5
votes
1 answer
How can keep master files after merge conflict in git
I fall in to this situation many times
1. I work on master branch and make some commits
2. Then i use git pull
3. Then i get auto merge fail , conflicting changes
Now suppose there were 5 files which were conflicting. I want to know
1. How can i…

user191542
- 275
- 1
- 7
- 17
5
votes
1 answer
Why git shows a merge conflict when the HEAD version has no content at the line
I'm trying to do a git merge master from another branch, then I got this conflict:
<<<<<<< HEAD
=======
t.text "label_en"
t.text "help_text_en"
t.text "options_en"
>>>>>>> master
I know how to resolve the conflict, but I'm…

I'm a frog dragon
- 7,865
- 7
- 46
- 49