It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Tip from the team: save your changes for later

Supported Platforms

  • macOS
  • Windows

 

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.

homer.jpg

 

Keep it safe

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

  • Git saves your current changes ("stash" in their terminology), automatically referencing the branch you're saving the changes from. You can optionally keep changes you've already staged and include a message to remind yourself about this particular stash.
  • Mercurial saves your current changes ("shelve" in their terminology), independent of any particular branch or tag. You'll need to give the shelved set of changes a meaningful, non-conflicting name. 

Sourcetree makes doing this easily accessible from the Repository menu, its keyboard shortcut, and the toolbar item.

stash_create_win.gifstash_create.gif

 

Return to work

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.

stashapply_win.gifstash_apply.gif

 

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!

 

Additional Reading:

0 comments

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Sourcetree

Sourcetree for Windows - CVE-2019-11582 - Remote Code Execution vulnerability

A vulnerability has been published today in regards to Sourcetree for Windows.  The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...

4,922 views 0 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you