简体   繁体   English

git“<<<<<<< HEAD”

[英]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. 我不确定究竟是什么造成了它,但是当我看到这条线时,“origin / master”大喊大叫git merge。 Has anyone encountered a similar issue or knows what these added lines intend to do? 有没有人遇到类似的问题或知道这些添加的行打算做什么?

git is telling you that you have conflicts. git告诉你你有冲突。

Resolve them: http://www.kernel.org/pub/software/scm/git/docs/v1.7.3/user-manual.html#resolving-a-merge 解决它们: 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 : 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. Git很难理解应该使用哪个更改,因此它会要求您提供帮助。

You can use git mergetool to resolve the conflicts 您可以使用git mergetool来解决冲突

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 你可以在这个答案中找到一些关于如何修复它的非常好的技巧(以及问题的其他答案) 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. 它表示两个分支都对特定文件进行了更改,并且git不确定要在合并中使用哪些更改。

To overcome this issue there are a number of tools available. 为了克服这个问题,有许多工具可用。 I use tortoisegit. 我用tortoisegit。

To resolve these issues in the command line run git mergetool and this will automatically bring up the UI to resolve these issues. 要在命令行中解决这些问题,请运行git mergetool,这将自动调出UI来解决这些问题。 The rest is self explanatory and you pick and choose which changes you want in the merge. 其余部分是自解释的,您可以在合并中选择所需的更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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