Interactive Rebase
With Interactive Rebase, Git offers a very powerful tool to edit / rewrite / reorder / etc. existing commits. Please note that Interactive Rebase is only available for the currently checked out branch. Therefore, make sure that your local HEAD
branch is selected in the sidebar.
Note: Use Interactive Rebase with care - because it will rewrite your commit history! As a rule of thumb, you should never rewrite commits that other people are already working with! If you run into troubles, the Reflog feature holds references to recent commits.
Delete
Interactive Rebase allows you to delete one or multiple commits. With you HEAD branch selected in the sidebar, choose the commits in question and right-click them. The contextual menu will then contain an option to
(or, in case you selected multiple commits: ).Squash
Squashing allows you to combine multiple commits into one. Simply select multiple commits in your HEAD branch's commit listing.
- Right-click them and select in the contextual menu.
- Alternatively, you can drag & drop them onto another commit to squash them.
When performing a Squash, the commit messages of all commits will be concatenated. The new, squashed commit appears at the earliest position of the previously selected commits.
Fixup
Fixup is very similar to squashing. However, while squashing preserves / combines all commit messages, fixup will use just the message of the oldest commit.
To start a Fixup, simply select multiple commits in your HEAD branch's commit listing.
- Right-click them and select in the contextual menu.
- Alternatively, you can drag & drop them onto another commit while holding option.
The Fixup then adds the changes of newer commits to the target commit. The target commit is referenced in the confirmation dialog.
Reorder Commits
Interactive Rebase also allows you to reorder commits. Simply drag and drop a commit between two existing commits to reorder history.
Edit Revision
Editing an existing commit allows you to both change the contained modifications and the commit's message. To edit an existing revision, right-click it in the commit listing and select
from the contextual menu.This will open the Working Copy view for this commit, where you can can change its message, the contents of the commit and even split it up.
To submit the changed revision, use
after committing your changes.Edit Commit Message
To edit only the commit message of a revision, right-click the revision in the commit listing. Then, choose
from the contextual menu to change the commit's message.