问题描述
我已阅读部分。
所以我按照它创建了一个分支: experimental $ c $然后我:
- 切换到实验分支(git checkout实验)
- 进行一系列更改
- 提交(git commit -a)
- 切换到master分支(git checkout master)
- 进行一些更改并在那里提交
- 切换回实验(git checkout experimental)
- 将主变更合并为experimental(git merge master)
-
有一些冲突,但在解决它们之后,我做了'git add myfile'
-
现在我被卡住了,我无法回到主人身边
当我做时
$ 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:
- switch to experimental branch (git checkout experimental)
- make a bunch of changes
- commit it (git commit -a)
- switch to master branch (git checkout master)
- make some changes and commit there
- switch back to experimental (git checkout experimental)
- merge master change to experimental (git merge master)
there are some conflicts but after I resolve them, I did 'git add myfile'
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.
这篇关于如何在解决我的合并冲突后完成合并?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!