One of the more common tasks of any developer's day is discarding work in progress, especially when switching branches for a 'quick' code review or to whip up a hotfix, and being able to manage that efficiently is key to unlocking productive workflows. Not to mention those times when you've been testing tweak after tweak, getting nowhere, and just want to get back to where you started without a lot of hassle. You might be tempted to copy the modified files or quickly make a copy of the whole directory and just go through diff after diff later but there's a painless, straightforward alternative.
What if I told you that both Git and Mercurial already know how save your changes and restore them later to finish and commit when you're ready? Well guess what… they do! Each might handle it a little bit differently under the hood but they are fundamentally the same behavior.
Reminder: saved changes are kept in your local working copy and never sent to a remote server; don't delete them or your working copy accidentally
Sourcetree makes doing this easily accessible from the Repository menu, its keyboard shortcut, and the toolbar item.
Once you're ready to dust off these changes and get back to them it's equally easily. You'll either "Apply Stash" (Git) or "Unshelve" (Mercurial) a particular set of saved changes and all you need to do is double-click on the entry in Sourcetree's sidebar or use the corresponding menu item. You're also given the choice of whether or not to delete that set of saved changes once it's been re-applied. If you're not quite sure yet keep them around and you can delete it later from the contextual menu.
Do you have your own stash tip or maybe even a favorite custom action to expand on what's built into Sourcetree? Feel free to comment below!
Mike CorsaroAtlassian Team
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs