Tortoisegit undo last commit into the repo

If you haven't pushed your changes yet (so your commit is only local)

  1. TortoiseGit -> Show log
  2. Select the commit to which you want to rollback to
  3. Reset "<branch>" to this...

If you have, then this can still be done, but then you'd have to also do a force-push (check "overwrite known changes" 1).

1The "overwrite known changes" flag will replace the already pushed commit with a new one. If there is a chance that someone already fetched the commit that you're replacing, don't use this feature, otherwise doing so will create a fork in the history with two conflicting truths.


There is also a shortcut for when you want to just (1) redo the last commit and (2) you haven't pushed it yet:

  1. Commit -> Check "Amend Last Commit"

That will replace the last commit with a new one. But I don't recommend using this - if the last commit is already pushed, you can end up with a big mess. TortoiseGit will not stop you here.

By doing a Reset you are forced to have a look at the log, and there you see if the commit is local or not.


If you need to revert back to the previous state before the last commit just select the commited action from the log list and select revert changes by this commit.

Take care, you need to commit and push again the changes made.