简体   繁体   中英

git “<<<<<<< HEAD”

I am working on my local repository and I recently tried to merge my branch with the remote master.

I noticed that in some classes there are some added lines such as:

<<<<<<< HEAD
=======
>>>>>>> origin/master

I was not sure what actually caused it but the "origin/master" yelled out git merge when I saw this line. Has anyone encountered a similar issue or knows what these added lines intend to do?

git is telling you that you have conflicts.

Resolve them: http://www.kernel.org/pub/software/scm/git/docs/v1.7.3/user-manual.html#resolving-a-merge

RE: https://help.github.com/articles/resolving-merge-conflicts :

This happens when two branches have changed the same part of the same file, and then those branches are merged together. For example, if you make a change on a particular line in a file, and your colleague working in a repository makes a change on the exact same line, a merge conflict occurs. Git has trouble understanding which change should be used, so it asks you to help out.

You can use git mergetool to resolve the conflicts

Those lines are added when you need to do a manual merge caused by a merge conflict. You can find some really good tips about how to fix it in this answer (and in the other answers to the question too) https://stackoverflow.com/a/7589612/377651

These new lines indicate a merge conflict between your currently working on branch and another branch that you want to merge with.

It indicates that both branches have made changes to a particular file(s) and that git is not sure which changes to use in the merge.

To overcome this issue there are a number of tools available. I use tortoisegit.

To resolve these issues in the command line run git mergetool and this will automatically bring up the UI to resolve these issues. The rest is self explanatory and you pick and choose which changes you want in the merge.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM