TortoiseGit Manual

Undo Changes

If you want to undo all changes you made in a file since your last commit you need to select the file, right click to pop up the context menu and then select the command TortoiseGitRevert A dialog will pop up showing you the files that you've changed and can revert. Select those you want to revert and click on OK.

Figure 2.49. Revert dialog

Revert dialog


If you want to undo a deletion or a rename, you need to use Revert on the parent folder (or commit or repository status dialog) as the deleted item does not exist for you to right-click on.

If you want to undo the addition of an item, this appears in the context menu as TortoiseGitDelete (keep local). This is really a revert as well, but the name has been changed to make it more obvious.

The columns in this dialog can be customized in the same way as the columns in the Check for modifications dialog. Read the section called “Status” for further details.

Undoing Changes which have been committed

Revert will only undo your local changes. It does not undo any changes which have already been committed. If you want to undo all the changes which were committed in a particular revision, read the section called “Log Dialog” and the section called “The Repository Browser” for further information.

Reverting a whole commit

If you want to undo a whole commit, then you should use the log dialog and select Revert change by this commit on a revision/commit (cf. the section called “Log Dialog”). Then all changes of this commit are undone and a revert commit is created which need to be committed manually (cf. git-revert(1) man-page). It is also possible to (hard) reset to a previous commit, then all commits after that are forgotten (cf. the section called “Reset”) - this might not be recommended if the changes are already pushed (also see https://stackoverflow.com/q/27032850/3906760).

Reverting to an old version of a file

If you want to revert a file to an older version open the Log Dialog (cf. the section called “Log Dialog”) on the file (or the folder if the file was deleted). Then select the specific commit you want to revert to. Now you have two options: 1) Select the specific file entry in the file list in the bottom and select Revert to this revision resp. Revert to parent revision in the context menu of the file entry. 2) Select Browse Repository (cf. the section called “The Repository Browser”) in the context menu of the revision. Then navigate to the file and either select Save revision to... or drag the file to the location where you want to use it.

Revert is Slow

When you revert changes you may find that the operation takes a lot longer than you expect. This is because the modified version of the file is sent to the recycle bin, so you can retrieve your changes if you reverted by mistake. However, if your recycle bin is full, Windows takes a long time to find a place to put the file. The solution is simple: either empty the recycle bin or deactivate the Use recycle bin when reverting box in TortoiseGit's settings.

Revert != "git revert" for files

In the TortoiseGit naming a "revert" on a file is comparable to git checkout HEAD -- filename (or git checkout REVISION -- filename) for resetting a file to it's last (or a specific) committed state. This has nothing to do with git-revert(1) man-page!

git-revert(1) man-page is only referred to by Revert change by this commit in log dialog (cf. the section called “Log Dialog”).