Using the Stash
The Stash is a kind of "clipboard" for your local changes: it saves all of your uncommitted changes and leaves your working copy in a clean state. You can restore it later, at any time.
When to Use the Stash
In your daily work, you'll often need to quickly get a clean working copy. This is advisable (or even necessary) before switching branches, performing a pull, merge, rebase, or cherry-pick. Instead of committing half-done work, you can use the Stash to safely store your local changes temporarily.
You can create as many Stashes as you like and restore them whenever and wherever you like (independent of the current branch).
Saving Changes on a Stash
Since stashing is such an important feature, Tower makes using it very easy: in the toolbar, you can click
Since stashing is such an important feature, Tower makes using it very easy: in the toolbar, you can click or press CTRL + S at any time to save your current local changes.
Providing a short but descriptive message will help you distinguish different Stashes later. As an option, Tower also offers to include untracked files when saving a Stash.
Please be Careful!
Stashing untracked files in Git can remove ignored files & folders as an undesired side-effect! This depends on how exactly the ignore rule is shaped: e.g. a folder that was ignored with /ignored-folder/* will be removed after stashing untracked files. In contrast, if the ignore rule is /ignored-folder, Git will not purge it.
Please note that this (definitely debatable) behavior is part of Git, not Tower. Read more about this issue here.
Inspecting Saved Stashes
To display a list of your saved Stashes, select the Stash item in Tower's sidebar. On the right, detailed information like the date, message, and changes for the selected item is shown.
To display a list of your saved Stashes, either select the Stash item in Tower's sidebar or press CTRL + 3. On the right, detailed information like the date, message, and changes for the selected item is shown.
Applying Changes from a Stash
To reapply a Stash - and thereby restore its changes in your working copy - you can perform one of the following actions:
- Use the button in the toolbar
- Right-click an item in the list of Stashes and select
- Use the
button below the header of a Stash item's details view
In the "Apply Stash" dialog, the following options are provided:
- "Delete Stash After Applying Changes" will directly delete the Stash after it was successfully applied.
- "Restore Staging Area Status" will try to also restore the status of the Git index for the stashed changes.
Automatic Stashing in Tower
In a lot of situations, having a clean working copy is (almost or indeed) mandatory - for example when checking out a different branch or when pulling from a remote. Since it's all too easy to forget to stash before starting such an operation, Tower's "Auto Stash" feature comes in handy: if you have uncommitted local changes, Tower will offer to automatically stash them for you.