回滚Git合并 [英] Rollback a Git merge

查看:155
本文介绍了回滚Git合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 开发分支
- >仪表板(工作分支)

我使用 git merge --no-ff develop

git log:

将任何上游更改合并到仪表板中

commit 88113a64a21bf8a51409ee2a1321442fd08db705
合并:981bc20 888a557
作者:XXXX<>
日期:星期一7月30日08:16:46 2012 -0500

将分支'develop'合并到仪表板

commit 888a5572428a372f15a52106b8d74ff910493f01
作者:root< ; root@magneto.giveforward.com>
日期:星期日7月29日10:49:21 2012年-0500

固定结束日期编辑显示有领导0

提交167ad941726c876349bfa445873bdcd475eb8cd8
作者: XXXX<>
日期:Sun Jul 29 09:13:24 2012 -0500

50+提交它,我想知道如何恢复合并,以便仪表板返回到合并前的状态。



第二部分是,如果我不要与 - no-ff 合并,我不会将提交'合并分支'开发'到仪表板'中。我把那个合并回来了?

解决方案

其他问题。当你进行一个快进合并,你描述的第二个合并时,你可以使用 git reset 回到之前的状态:

  git reset --hard< commit_before_merge> 

您可以找到< commit_before_merge> git reflog git log ,或者,如果您感觉mox(并且没有做其他事情): git reset --hard HEAD @ {1}


develop branch
--> dashboard (working branch)

I use git merge --no-ff develop to merge any upstream changes into dashboard

git log:

commit 88113a64a21bf8a51409ee2a1321442fd08db705
Merge: 981bc20 888a557
Author: XXXX <>
Date:   Mon Jul 30 08:16:46 2012 -0500

    Merge branch 'develop' into dashboard

commit 888a5572428a372f15a52106b8d74ff910493f01
Author: root <root@magneto.giveforward.com>
Date:   Sun Jul 29 10:49:21 2012 -0500

    fixed end date edit display to have leading 0

commit 167ad941726c876349bfa445873bdcd475eb8cd8
Author: XXXX <>
Date:   Sun Jul 29 09:13:24 2012 -0500

The merge had about 50+ commits in it, and I am wondering how to just revert the merge so dashboard goes back to the state pre-merge

The second part of this is, if I dont do merge with --no-ff, I don't get the commit 'Merge branch 'develop' into dashboard' .. How would I roll that merge back?

解决方案

Reverting a merge commit has been exhaustively covered in other questions. When you do a fast-forward merge, the second one you describe, you can use git reset to get back to the previous state:

git reset --hard <commit_before_merge>

You can find the <commit_before_merge> with git reflog, git log, or, if you're feeling the moxy (and haven't done anything else): git reset --hard HEAD@{1}

这篇关于回滚Git合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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