Stash A File With SourceTree
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This article should help users to perform a git stash with SourceTree.
Solution
Read here to learn more about git stash operations: https://git-scm.com/book/en/v1/Git-Tools-Stashing
A mercurial equivalent of Stash is called Shelve: https://www.mercurial-scm.org/wiki/ShelveExtension
If a mercurial repository is opened in SourceTree, the function will appear as Shelve instead of git's Stash.
To stash your changes:
First, there has to be a change done to a file.
Once there's a change, then the Stash button at the dashboard will be enabled by SourceTree to be used:

Clicking on Stash will trigger this window to pop up:

Steps:
Enter a description message
Check "Keep staged changes" if you want to keep the rest of the changes that are staged.
Click OK.
You will then notice a new column that appears at the sidebar, called Stashes. And the file is now changed back to the state before it was modified:

To apply back the changes, simply right-click on the Stash created, and click Apply Stash. Your file should revert back to the modified version:

Was this helpful?