This question already has an answer here:

I have a stash saved for the future that I want to give a meaningful name. While it's possible to pass a message as argument to git stash save, is there a way to add a message to an existing stash?

marked as duplicate by CharlesB git Jul 24 '17 at 13:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I recognize that this question is older than the flagged duplicate, but that question has better answers. – Michael Jul 12 '17 at 21:29
up vote 48 down vote accepted

You can directly edit the messages stored in .git/logs/refs/stash.

I know it's probably not ideal, but should work anyway.

  • 5
    The fact that that seems to work is incredibly lucky: the message is also stored in the commit message (stashes are represented internally as commits), and you're of course not changing that. – Cascabel Nov 14 '11 at 19:22
  • 1
    It does work; thanks a lot – CharlesB Nov 15 '11 at 9:23
  • 3
    This doesn't actually change the commit message (see git show stash or git log --all), only the entry in the stash reflog. – Zaz Aug 6 '14 at 20:13

Not without popping and saving again.

  • 2
    while seemingly inelegant this is the easiest solution – Kirby Aug 16 '12 at 15:41
  • 1
    Not that simple if your stashes are across various branch as "popping and saving again" would apply the stashed commit to the current branch (which could fail on merge). If you find yourself with a long list of sashes you probably need to make better use of branching. – i3ensays Sep 9 '13 at 17:01
  • 1
    at first I thought he said "Not without pooping" – void.pointer Jan 10 '14 at 19:27
  • 2
    @RobertDailey well if you popped the stash and there are merge conflicts, you will very much be pooping yourself. – David T. May 8 '14 at 21:12
  • there is git stash save "your message" – woohoo Jan 23 '17 at 15:32

(Expanding on manojlds's answer.) The simplest thing to attach a message is indeed to un-stash and re-stash with a message, there is a git stash branch command that will help you doing this.

git stash branch tmp-add-stash-message
git stash save "Your stash message"

The only drawback is that this stash now appears to originate from the tmp-add-stash-message branch. Afterwards, you can checkout another branch and delete this temporary branch.

Of course, this assumes that your working copy is clean, otherwise you can stash the current changes :-)

Yep, there is a way, you can try this:

git stash store -m "your descriptive message here" stash@{1}

This will create a new Stash named stash@{0} with the message as above.
This Stash is same as stash@{1}.

Then you can remove the old stash@{1} above with:

git stash drop stash@{2} # the stash@{1} has become stash@{2} as a new stash has been created.

NOTE: you cannot do this with stash@{0}: git stash store -m "message here" stash@{0} will do nothing.

  • 1
    Why doesn't it work with stash{0}? – CharlesB Oct 30 '14 at 9:58
  • Actually I don't know, I tried and it didn't work. So I guess that: If this calls on stash@{1}, then it brings a copy of stash@{1} to top of the stack, so when user call git stash apply, he get different result. If this calls on stash@{0}, then later call to git stash apply produces in same result. – Ryan Le Oct 30 '14 at 10:29
  • there is git stash save "your message" – woohoo Jan 23 '17 at 15:32

Here's some commands to help you pop and save again as @manojlds suggests:

git stash #save what you have uncommitted to stash@{0}
git stash pop stash@{1} #or another <stash> you want to change the message on
# only if necessary, fix up any conflicts, git reset, and git stash drop stash@{1}
git stash save "new message"
git pop stash@{1} #get back to where you were if you had uncommitted changes to begin with

Not the answer you're looking for? Browse other questions tagged or ask your own question.