Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git merge mangles source files

Tags:

git

I've run into some strange behavior with git and I was wondering if anyone has any experience with it. I have two branches, stable and master, that I have merged after resolving conflicts. Unfortunately, the master branch (which should now reflect all of the changes in stable) will not compile due to the insertion of markup by git. It looks something like this:

>>>>>>> stable
=======

Duplicate code will usually appear between the markups, presumably to differentiate between code in the different branches.

Ideas? Thoughts? Doinitwrong?

like image 273
danthehat Avatar asked Feb 24 '23 05:02

danthehat


1 Answers

Correct, that mangling is git's way of showing you what the conflicts are. They are called 'conflict markers'. When resolving conflicts you need to remove those extra characters as you go along and pick the correct side to keep (old vs new code).

Once you have resolved all the conflicts and removed the extra characters/lines then add and commit those changes to finish the merging of the branches.

Here is tutorial about basic branching and merging and another right from the git manual on resolving conflicts.

like image 182
RDL Avatar answered Feb 26 '23 19:02

RDL