Git:如何在重新设置基准点期间撤消合并 [英] Git: how to undo merge during rebase

查看:249
本文介绍了Git:如何在重新设置基准点期间撤消合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经进行了重新定位:

I've made a pull with rebase:

git pull --rebase

成功应用了两次提交之后,我开始应用第三次提交.在此过程的中间,我意识到我做错了,撤消它会很好.我当然可以做git

After two commits were successfully applied I started applying the third one. It the middle of this I realized that I did it wrong and it would be good to undo it. Of course I can do git

rebase --abort

但是我将放弃所有已完成的工作(两次应用提交).

but then I'll loose all the work I've done (two applied commits).

有什么方法可以撤消在变基期间应用当前提交并重新开始合并的过程吗?

Is there any way to undo the process of applying current commit during rebase and start merging again?

推荐答案

您可以进行

git rebase --skip

(也许多次)

这样,您保存的提交将被保存.但是,到那时,您的第三次提交将被隐藏,因此请继续:

That way, your applied commits will be saved. However at that point your third commit will be hidden, so follow up with:

git branch old-commit ORIG_HEAD

有权访问您的其他(之后的三分之一)提交.

to have access to your other (third an following) commits.

要画龙点睛,您可以

git checkout old-commit && git rebase --interactive HEAD...master

并删除成功的基于基础的提交.

and remove the successfully rebased commits.

这篇关于Git:如何在重新设置基准点期间撤消合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆