Quantcast
Channel: How do I recover a dropped stash in Git? - Stack Overflow
Viewing all articles
Browse latest Browse all 52

Answer by Dolda2000 for How to recover a dropped stash in Git?

$
0
0

If you didn't close the terminal, just look at the output from git stash pop and you'll have the object ID of the dropped stash. It normally looks like this:

$ git stash pop[...]Dropped refs/stash@{0} (2ca03e22256be97f9e40f08e6d6773c7d41dbfd1)

(Note that git stash drop also produces the same line.)

To get that stash back, just run git branch tmp 2cae03e, and you'll get it as a branch. To convert this to a stash, run:

git stash apply tmpgit stash

Having it as a branch also allows you to manipulate it freely; for example, to cherry-pick it or merge it.


Viewing all articles
Browse latest Browse all 52

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>