1

Several different developers have changed the same code that I changed. When I merge manually with git I see something like this:

<<<<<<< HEAD

    //some code

=======

   //usually the exact same code


>>>>>>> 487a27067d58bca3d48fcfbae33f61c20a75345a

Can someone tell me how to interpret this. Is the part between the head and equal sign usually what used to be in my version? I referred to this post to understand what head exactly is but I'm still very unsure.

Community
  • 1
  • 1
roshambo
  • 97
  • 2
  • 11
  • 1
    **Please read [Pro Git: 3.2 Git Branching - Basic Branching and Merging - Basic Merge Conflicts](http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging#Basic-Merge-Conflicts)**. –  May 27 '14 at 16:48

2 Answers2

2

If the code is the same, you can go ahead and remove the markers and duplicate code and your merge is ready to go.

However usually it's different, in which case the top section shows changes made on the branch that is being merged into which in most cases is your local copy. The bottom section shows the changes made on the branch you're trying to merge into your copy.

avrhack
  • 46
  • 3
1

The code between <<<<<<< HEAD and ======= is the version on your local side when you are doing a merge.

HEAD can be simple thought of as the commit you were on before doing initializing the merge.

This is a good description of merge conflicts - http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging#Basic-Merge-Conflicts

manojlds
  • 290,304
  • 63
  • 469
  • 417