Pedro Nobre de Figueiredo Pedro Nobre de Figueiredo - 1 year ago 231
Git Question

On sourcetree, how can I recover stashes after checkout on a different branch?

I had some stashed changes while I was working on a branch.

I wanted to work locally on a different branch so I did checkout into a new branch and lost all the stashes from sourcetree sidebar.

Here is a screenshot of sourcetree:


If I type

git stash list
on my terminal I get a list of the stashes...

stash@{0}: On feature/SITE-5-doctor-name-at-checkin-success: Before commits
stash@{1}: WIP on feature/SITE-5-doctor-name-at-checkin-success: df48232 WIP show dummyDoctor on success page
stash@{2}: WIP on feature/SITE-5-doctor-name-at-checkin-success: 82b1aed Linting
stash@{3}: On feature/SITE-5-doctor-name-at-checkin-success: DEBUG I know they are not lost.

How do I get them back to my sourcetree sidebar so I can use them in any of those branches?

Answer Source

Welcome to Stack Overflow :)

Stashes are indeed listed in the sidebar, but in your image they're collapsed. The 'Show' links next to Tags, Remotes, Stashes, etc only show on hover.

Note that trying to apply a stash from one branch to another branch may result in conflicts to resolve. In this case, sourcetree will not delete your stash automatically, as it would usually, rather you'll need to right click and 'delete' stashes once you've successfully applied them.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download