Frequently asked questions around Git and Version Control.

How can I undo an older commit?

There are a couple of ways to "undo" commits in Git. The "reset" command, for example, allows you to restore your project at any previous revision - effectively "undoing" all the commits that came afterwards. If this what you want to achieve, read more about "reset".

A different situation, however, is when you want to undo the effects of only a certain commit - and not discard any commits that came after that one. This is a classic scenario for the "revert" command.

The Git Cheat Sheet

No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!

Reverting a Commit

Using the revert command doesn't delete any commits. Quite the contrary: it creates a new revision that reverts the effects of a specified commit:

The syntax to do this is easy. Just use the revert command and provide the commit you want to "undo":

$ git revert 0ad5a7a6

In case you are using the Tower Git client, the revert command is easily available in the right-click menu of a commit item:

Learn More

About Us

As the makers of Tower, the best Git client for Mac and Windows, we help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Ebay get the most out of Git.

Just like with Tower, our mission with this platform is to help people become better professionals.

That's why we provide our guides, videos, and cheat sheets (about version control with Git and lots of other topics) for free.