我有远程存储库。我有:
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),我要做的是:
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,解决冲突和提交,但它没有帮助(我测试了它)。
发布于 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继续重新建立基础并应用您的提交而添加。
https://stackoverflow.com/questions/19445186
复制相似问题