Undoing Commits
When you want to undo a commit, you have two basic options: reset and revert.
Note: Both reset and revert can only be performed on your HEAD branch. Therefore, make sure to select your current HEAD in the BRANCHES section of Tower's sidebar.
In other contexts, you'll find the menu items for these features disabled.
Reset
The "reset" feature is sometimes also referred to as a "rollback". It restores your project just like it was at some defined version in the past. All commits that came after this version will be undone. To reset your HEAD branch to a certain commit:
- Make sure your current HEAD branch is selected in the sidebar
- Right-click the commit you want to return to in the list and choose . Select the "Keep Changes" option if you want all changes from rolled back revisions to be kept in your working directory.
Revert
The "revert" feature solves a different problem: You might have one particular commit that you want to undo - but you don’t want to touch any other commits that came after it. Revert solves this problem by creating a new commit that contains opposite changes - essentially reverting the effect of those changes. E.g. if you deleted some lines in a certain commit, reverting it will create a new commit that adds exactly these lines, again.
To revert one or more commits:
- Make sure your current HEAD branch is selected in the sidebar
- Select the commit(s) you want to revert in the list and choose the option from the right-click menu.