bundy

* Modular * Extensible * Friendly *

[Bundy-hackers] Accidentally merged "issue13" branch

神明達哉 jinmei at wide.ad.jp
Thu May 15 17:23:01 CEST 2014


At Thu, 15 May 2014 14:04:31 +0200,
Tomek Mrugalski <tomasz at isc.org> wrote:

> > Can anyone with git knowledge/experience tell me if it is possible to
> > "undo" such an accidental merge?
> git revert id-of-the-commit-you-want-to-get-rid-of
>
> This will create an inverse commit that will undo your commit. There
> will still be a trace in the git history, but that's ok.

I think this is about commit d575ac.  In this specific case, it's
probably okay to just do 'git revert d575ac' as this is a fast-forward
merge and d575ac should be pretty (if not completely) independent from
subsequent commits.

In general, though, "undoing an accidental merge" could be more
trickier:
- you'll need to specify the "parent number" corresponding to the
  branch you want to keep after the revert
- there may already be subsequent commits that depend on some changes
  made in the to-be-reverted branch.  in that case reverting the merge
  commit (or for that matter any revert commit, not necessarily
  reverting a merge) may require some kind of conflict resolution

This will also help (although I'm afraid it contains too much
information for a person just starting using git and can be rather
confusing):
http://schacon.github.io/git/howto/revert-a-faulty-merge.txt

And, in this very specific case, I guess we might not have to revert
it, assuming Tomek reviewed the change.

--
JINMEI, Tatuya