Search code examples
gitgit-merge

Branch name becomes strange


I manually produced a merge conflict in my test repository. Here is the conflict:

<<<<<<< HEAD

++Carry

=======

++Mid

>>>>>>> 635e85d6e45907a6b1c63d934618040adcbb8474

The "635e85d6e45907a6b1c63d934618040adcbb8474" confuses me. Shouldn't this be the branch name instead


Solution

  • 635e85d6e45907a6b1c63d934618040adcbb8474 is the name of the head of a certain commit. Git gives you the possibility to "travel in time" back to the previous version of your code. The number signifies a specific commit.

    You can find a list of commits by running git log and find the same number there.

    git branch to see what branch you're on if your branch is, for example, called developer then you can run git checkout developer to get back to that branch.

    the <<<<<<< and >>>>>> indicate that the same files have been changed from multiple sources, and its trying to merge, but it doesn't know which one to keep.

    I highly suggest you refer to the documentation https://git-scm.com/doc