git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: how to undo a git merge?

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Jul 11, 2008, 18:14 UTC
Message-ID
<20080711181413.GI10347@genesis.frugalware.org>
In-Reply-To
<fa7d16350807111107o40c5cbb5xc06c3c56b16b7499@mail.gmail.com>
[ Did you reply off-list intentionally? ]
On Fri, Jul 11, 2008 at 02:07:44PM -0400, ff <ff@member.org> wrote:
Show 7 quoted lines
> thank you.
> 
> I did see the -m option in the revert man page. It talks about
> "parent" and I did
> not understand what that is. Is parent the commit id of the merge commit?
> 
> Thanks again!
http://www.kernel.org/pub/software/scm/git/docs/gitglossary.html#def_parent

A merge commit has two parents, but obviously only one of the was the HEAD commit before the merge. So when you revert a merge, you need to specify which which parent's tree should be the tree of the new HEAD.

For example, if you were on branch 'master' and you merged 'foo' to master using 'git merge foo', and you want to revert that merge then you need '-m 1'.

Previous: Jakub NarebskiNext: ff
Message 4 of 8 in “how to undo a git merge?”
  1. ffJul 11, 2008
  2. Miklos VajnaJul 11, 2008
  3. Jakub NarebskiJul 11, 2008
  4. Miklos VajnaJul 11, 2008
  5. ffJul 11, 2008
  6. Miklos VajnaJul 11, 2008
  7. Sverre RabbelierJul 11, 2008
  8. Jakub NarebskiJul 11, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.