How do I unshelve changes

I found myself accidentally making changes in the wrong branch before I checked anything in. I tried to switch branch and it told me I couldn't because I had outstanding changes. I read that I could shelve changes, switch branch and then retrieve those changes on the correct branch.

I have done the first two steps but now can't find a way to actually unshelve the changes. I can't find anything in menus either in the toolbar or context menus. I've looked in the .hg/attic directory and I can see the changes stored there so I know that its not that they don't exist.

3 answers

1 accepted

In the left panel of your repository, (not counting bookmarks, if you're on windows), you should see expandable lists for "File Status", "Branches", "Tags", "Remotes", and "Stashes" ("Shelves"). Some of the terminology may be slightly different, because I use Git, not Mercurial.

You should be able to expand Shelves, and right click a shelf to apply/delete.

Ah yes. I can see it now. I'd totally missed that thing (it was collapsed by default so didn't really impinge on my vision). Thanks very much! As it is I have mannually redone things for now but it will be massively useful for the future. :)

How did you do the shelving?

I cannot speak for mercurial but for git only - I think the procedure is called "stashing" in git

  • Select the modified files you want to be shelved (stashed)
  • Press the "Stash" button in the toolbar. You will be asked for a symbolic name for the stash/shelve
  • All the selected modified files will be put into the stash with the given name
  • You'll see the stash in sourcetree's view, were tags and branches are located ("Stashes")
  • Switch to your desired branch
  • Right click on your stash
  • "Apply Stash" ....
  • .... and you are done. After successful applying the stash you might want to remove it ...

Using Sourcetree 1.3.3 on Windows.

Hope that helps

Wrote the answer simultanously ... :-)

That is very helpful but sadly just a bit slower than Seth. I did indeed stash as you suggested but hadn't really understood how it worked so was just expecting a similar "unstash" button somewhere to click on. What you say makes perfect sense now and will make me more efficient with sourcetree now. :)

I figured. I'm on stackoverflow a lot where this looks like it comes from and am very used to the whole simultaneous answers thing. ;-)

For newbies, there is a Hide/Show option when you mouseover each category, e.g.BRANCHES, BOOKMARKS, ..., SHELVED.  You may need to hide some other list and show the desired list.

If you don't see the hide/show options, try expanding the sidebar to make it wider. These links are apparently only shown if there is room.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

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...

561 views 1 2
Read article

Atlassian User Groups

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!

Find my local user group

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

Groups near you