首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >git rebase with conflict not work

git rebase with conflict not work
EN

Stack Overflow用户
提问于 2013-10-18 16:40:18
回答 1查看 14.6K关注 0票数 11

我有远程存储库。我有:

代码语言:javascript
复制
git clone https://mylogin@bitbucket.org/mylogin/myrepo.git

克隆成功。我有git树:

C(master)

|*B:A

|/

B:/

|

一个

|

A0

|

A01(源/头)(源/主)

|

(一些提交)

我需要:

*B:A

C(Master):/c

我需要将分支B重设为C(master),我要做的是:

代码语言:javascript
复制
git checkout b1
Switched to branch 'b1'
git rebase master
First, rewinding head to replay your work on top of it...
Applying: B:A
Using index info to reconstruct a base tree...
M   index1.txt
Falling back to patching base and 3-way merge...
Auto-merging index1.txt
CONFLICT (content): Merge conflict in index1.txt
Failed to merge in the changes.
Patch failed at 0001 B:A
The copy of the patch that failed is found in:
   /pth/to dir/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

git branch
* (no branch)
  b1
  master

我必须做什么?我可以切换到分支b1,解决冲突和提交,但它没有帮助(我测试了它)。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-10-18 19:47:35

如果Git检测到无法自动解决的冲突,它将停止rebasing。在您的示例中,文件index1.txt中存在冲突(您可以在输出中看到它,稍后在运行git status时也可以看到它)。您必须先修复冲突,然后才能继续。编辑该文件,您将看到<<<<<<======>>>>>>标记。冲突发生在这些行中,其中<=之间的内容是主目录中的更改,之后(直到>)是分支b1中的更改。修复它,删除git标记(<=>),然后运行git add index1.txt,然后转到下一个文件(如果有,在本例中只有index1.txt冲突)。添加完所有文件后,运行git rebase --continue。如果git遇到另一个冲突,只需对它有问题的每个文件重复该过程。一旦你完成了,git会告诉你rebase已经成功完成,你会回到分支b1。如果您想停止该进程并返回到原始b1 (在rebase命令之前),只需运行git rebase --abort

请记住,当您修复冲突时,不要将文件编辑为在最终提交时的状态,而是只引入您希望在该特定提交中进行的更改。其他更改将随着git继续重新建立基础并应用您的提交而添加。

票数 28
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19445186

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档