26

I have a git repo and am having trouble reverting a merge. The current hash is 0ce2ca0b35f59af267241cf4d40d16a3e13ba6f3. and it has two parents:

df1acf5f54426d30f12c6b4558c3dd922297aae3
e19b912404ffd3c153ccac3072dbf22396896d2a

doing the following will revert to df1acf5f54426d30f12c6b4558c3dd922297aae3

git revert -m 1 0ce2ca0b35f59af267241cf4d40d16a3e13ba6f3

how do I revert to e19b912404ffd3c153ccac3072dbf22396896d2a?

NorthIsUp
  • 17,502
  • 9
  • 29
  • 35

1 Answers1

27
git revert -m 2 0ce2ca0b35f59af267241cf4d40d16a3e13ba6f3

Parents are numbered starting with 1; you want the second one.

mipadi
  • 398,885
  • 90
  • 523
  • 479
  • 11
    `git show 0ce2ca0b35f59af267241cf4d40d16a3e13ba6f3` will tell which are the parents: `Merge: df1acf e19b91` – lukmdo Mar 29 '12 at 13:36
  • 3
    @lukmdo that should be `git show --format=full [hashish]`. The default setting of git show doesn't show merge parents. – Nik Reiman May 28 '12 at 13:58