Conflict when doing a git merge, HEAD and DEVELOP, which is which?

Question:

I have run into a conflict when merging a branch to my develop .

git could not resolve it automatically and I have come across that I have edited the file including this:

<<<<<<< HEAD
    some code 
=======
    some other code
>>>>>>> develop

I have been able to solve it manually by editing the file and commit , but I have been left wondering, what is HEAD ? I assume that develop is also the develop branch where it would be merged, is that right?

Suppose my branch is called foo and I want to merge develop (both locally).

Answer:

HEAD is the last commit of the branch from where you merge

So if you want to leave the branch changes where you were located when you merged, remove the develop lines. If, on the contrary, you want to leave the changes of the develop branch, remove the lines from HEAD

Scroll to Top