Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git conflict markers [duplicate]

After I pulled from remote branch, I got conflict, when I open the file it looks something like below:

<<<<<<< HEAD:file.txt Hello world ======= Goodbye >>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt 

I need some explanations of the markers, which portion of code is pulled from remote and which is from local?

What does the code 77976da35a11db4580b80ae27e8d65caf5208086 stand for?

like image 955
Mellon Avatar asked Oct 26 '11 11:10

Mellon


People also ask

How do I remove a conflict marker in github?

Under your repository name, click Pull requests. In the "Pull Requests" list, click the pull request with a merge conflict that you'd like to resolve. Near the bottom of your pull request, click Resolve conflicts.

What do merge conflict markers mean?

A merge conflict usually occurs when your current branch and the branch you want to merge into the current branch have diverged. That is, you have commits in your current branch which are not in the other branch, and vice versa.


1 Answers

The line (or lines) between the lines beginning <<<<<<< and ====== here:

<<<<<<< HEAD:file.txt Hello world ======= 

... is what you already had locally - you can tell because HEAD points to your current branch or commit. The line (or lines) between the lines beginning ======= and >>>>>>>:

======= Goodbye >>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt 

... is what was introduced by the other (pulled) commit, in this case 77976da35a11. That is the object name (or "hash", "SHA1sum", etc.) of the commit that was merged into HEAD. All objects in git, whether they're commits (version), blobs (files), trees (directories) or tags have such an object name, which identifies them uniquely based on their content.

like image 73
Mark Longair Avatar answered Sep 23 '22 06:09

Mark Longair