Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 143
    I found this answer the clearest. git revert HEAD^ is not the previous, is the previous of the previous. I did : git revert HEAD and then push again and it worked :) Commented Jul 14, 2011 at 8:32
  • 13
    If Git asks you "More?" when you try these commands, use the alternate syntax on this answer: stackoverflow.com/a/14204318/823470 Commented Mar 5, 2020 at 15:50
  • 1
    revert deleted some files I add added to my repo. Use it with caution! Commented Jul 31, 2021 at 22:25
  • Specifically, if Git asks you "More?" when you try these commands on WIndows, you need to do 'git reset --hard "HEAD^"'. The doublequotes around "HEAD^" prevent Windows from interpreting ^ as a metacharacter. Commented Jun 6, 2024 at 21:00