On Tue, Oct 16, 2012 at 11:08:47PM -0700, seonguk.baek wrote: > branch : dev01 > 1 - 2 - 3(HEAD) > > branch : dev02 > 1 - A - B (HEAD) > > git merge dev02 into dev01 > > branch : dev01 > 1 - A - 2 - B - 3 - Merge Commit(HEAD)
That's incorrect: after merging, dev01 looks like this: - 2 - 3 - / \ 1 M (HEAD, merge commit) \ / - A - B - I mean, the commits between 1 and M made on both branches before the merge are not somehow intertwined, as you depicted them -- they are separate contiguous lines of history, which can be traced separately from M back to 1, along both paths. > and I push dev01 to remote repository. > > How can I rollback Merge Commit in remote repostiroy? > > Is it possible revert? There are two options: 1) Use `git revert -m 1 HEAD` to undo the merge. NOTE that `git revert` records a new commit which will contain the changes necessary to *textually* undo the previous commit. NOTE that you have to pass the "-m <parent_number>" option to the command for it to know what line of ancestry it should declare itself as following (because a merge commit references two or more lines of history and so undoing it requires picking one of them). NOTE that recording such a reversion commit might have a far-reaching repercussions, as `git revert` manual notes. In particular, it advises you to read [1] before proceeding. 2) When being on a dev01 branch, just do `git reset --hard 3` ("3" means the tip commit on dev01 before the merge) and then push again, with the --force option. That will rewrite the history in the remote repository which might be a bad thing in itself if someone already managed to fetch your merge commit and base their history on it. 1. http://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-users@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.