Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I unshelve changes

Chris Venus January 22, 2014

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

8 votes
Answer accepted
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2014

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.

Chris Venus January 22, 2014

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

4 votes
Johannes Kilian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2014

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

Johannes Kilian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2014

Wrote the answer simultanously ... :-)

Chris Venus January 22, 2014

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

Chris Venus January 22, 2014

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

1 vote
Linh Vanngo December 21, 2015

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.

J.D. Grimes May 1, 2018

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
TAGS
AUG Leaders

Atlassian Community Events