撤消git合并(尚未推送) [英] Undo a git merge (hasn't been pushed yet)

查看:129
本文介绍了撤消git合并(尚未推送)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚对我的一个功能分支(feedback_tab)进行了一些更改,然后签出主并将它们合并到那里。我实际上是想将它们合并到我的开发分支中。

现在,master在17次提交之前领先于'origin / master'(它的远程) - 我没有' t推动合并(显然不想)。我怎样才能将主人恢复到意外合并之前的相同状态?我在 git revert git reset 之间感到困惑。



我查看了我的git日志,并且没有用于将feedback_tab合并到master中的条目。我本来以为这是最好的入口?



有点困惑:/任何帮助欢迎! max

解决方案

git reset --hard HEAD〜17 17在主人之前提交。 git rebase -i HEAD〜17 可能会被删除额外的提交。


I just committed some changes into one of my feature branches ("feedback_tab") then, checked out "master" and merged them in there. I actually meant to merge them into my "development" branch.

Now, master is ahead of 'origin/master' (its remote) by 17 commits - I haven't pushed the merge up (and don't want to, obviously). How can I revert master back to the same state as before the accidental merge? I'm confused between git revert and git reset with this stuff.

I looked in my git log and there's no entry for merging feedback_tab into master. I'd have thought it would be the top entry?

Bit confused :/ any help welcome! max

解决方案

git reset --hard HEAD~17 takes you back 17 commits ahead of the head of master. git rebase -i HEAD~17 probably gets rid of the extra commits as well.

这篇关于撤消git合并(尚未推送)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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