如何在解决我的合并冲突后完成合并

如何在解决我的合并冲突后完成合并

本文介绍了如何在解决我的合并冲突后完成合并?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读部分。



所以我按照它创建了一个分支: experimental


  1. 切换到实验分支(git checkout实验)

  2. 进行一系列更改

  3. 提交(git commit -a)

  4. 切换到master分支(git checkout master)

  5. 进行一些更改并在那里提交

  6. 切换回实验(git checkout experimental)

  7. 将主变更合并为experimental(git merge master)

  8. 有一些冲突,但在解决它们之后,我做了'git add myfile'


  9. 现在我被卡住了,我无法回到主人身边


当我做时

  $ git checkout master 
错误:Entry'res / l合并覆盖ayout / my_item.xml'。无法合并。

我做了:

  $ git rebase --abort 

没有发生重置?



,我做了:

  $ git add res / layout / socialhub_list_item.xml 
$ git checkout master
错误:条目'res / layout / my_item.xml'将被合并覆盖。无法合并。

我该怎么做才能回到我的主分支?

解决方案

在合并期间发生冲突时,必须手动完成合并提交。这听起来像你已经完成了前两步,编辑冲突的文件,然后对它们运行 git add 来标记它们已解析。最后,您需要实际提交 git commit 的合并。此时您将可以再次转换分支。


I've read the Basic Branching and Merging section of the Git Community Book.

So I follow it and create one branch: experimental.

Then I:

  1. switch to experimental branch (git checkout experimental)
  2. make a bunch of changes
  3. commit it (git commit -a)
  4. switch to master branch (git checkout master)
  5. make some changes and commit there
  6. switch back to experimental (git checkout experimental)
  7. merge master change to experimental (git merge master)
  8. there are some conflicts but after I resolve them, I did 'git add myfile'

  9. And now i am stuck, I can't move back to master

when I do

 $ git checkout master
error: Entry 'res/layout/my_item.xml' would be overwritten by merge. Cannot merge.

and I did:

$ git rebase --abort

No rebase in progress?

and I did :

$  git add res/layout/socialhub_list_item.xml
$ git checkout master
error: Entry 'res/layout/my_item.xml' would be overwritten by merge. Cannot merge.

What can I do so that I can go back to my master branch?

解决方案

When there is a conflict during a merge, you have to finish the merge commit manually. It sounds like you've done the first two steps, to edit the files that conflicted and then run git add on them to mark them as resolved. Finally, you need to actually commit the merge with git commit. At that point you will be able to switch branches again.

这篇关于如何在解决我的合并冲突后完成合并?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 05:17