如何解决Git合并冲突 [英] How to resolve Git merge conflict
问题描述
我是github的新手,正在尝试合并master和gh-pages分支.
I am new with github and am trying to merge my master and gh-pages branches.
在尝试合并时,我遇到了冲突.现在,我收到以下消息
While trying to merge, I had a conflict. Now I get the following message
我该如何解决?
推荐答案
看看您的当前状态:
git status
您可能会看到一些准备提交的文件和一些具有本地更改的文件.分阶段的是那些合并没有问题的.具有本地更改的服务器具有合并冲突.打开每个文件,您会在内部某处看到这样的内容:
You'll probably see some files which are staged for commit and some which have local changes. The staged ones are those which merged without problem. The ones with local changes have merge conflicts. Open up each of those files, and you'll see something like this somewhere inside:
<<<<< master
// some code that was in master
=====
// some code that was in gh-pages
>>>>> gh-pages
(我认为还是那样)
编辑它们中的每一个,使它们如您所愿(即:解决冲突).然后按照提示进行操作:
Edit each of them so they are how you want them to be (ie: fix the conflicts). Then do as it says:
git add the/file/i/fixed.txt
git commit
这篇关于如何解决Git合并冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!