How can I rename a git stash? – Stack Overflow
Posted by jpluimers on 2019/03/07
SourceTree does not like it when by accident two git stash entries have exactly the same name.
To work around that, you have to rename one.
The easiest way to do this is on the console using the tips from [WayBack] How can I rename a git stash? – Stack Overflow (thanks [WayBack] qzb):
$ git stash list
stash@{0}: WIP on master: Add some very important feature
stash@{1}: WIP on master: Fix some silly bugFirst, you must remove stash entry which you want to rename:
$ git stash drop stash@{1}
Dropped stash@{1} (af8fdeee49a03d1b4609f294635e7f0d622e03db)Now just add it again with new message using sha of commit returned after dropping:
$ git stash store -m "Very descriptive message" af8fdeee49a03d1b4609f294635e7f0d622e03dbAnd that’s it:
$ git stash list
stash@{0}: Very descriptive message
stash@{1}: WIP on master: Add some very important featureThis solution requires git 1.8.4 or later, and yes, it works with dirty working directory too.
Some other useful git stash commands:
- Via [WayBack] Git: see what’s in a stash without applying stash – Stack Overflow: show the most recent
{0}and prior{1}stash:git stash show -pgit stash show -p{1}
- Via: [WayBack] git – Get the creation date of a stash – Stack Overflow:
git stash list --date=local
- Via: [WayBack] git – How to view stash date/timestamp next to stash id? – Stack Overflow
git stash list --date=relative
–jeroen






Leave a comment