Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Git stash message [duplicate]

Tags:

git

git-stash

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?

like image 552
CharlesB Avatar asked Nov 14 '11 16:11

CharlesB


People also ask

What happens if I git stash twice?

If you made two stashes, then just call git stash pop twice. As opposed to git stash apply , pop applies and removes the latest stash. You can also reference a specific stash, e.g.

How do you stash changes with messages?

Save a stash with a message: $ git stash save <message> . Try this out by adding CSS-line high to your styles and stash it with a nice comment. When you git stash or git stash save , Git will create a Git commit object with a name and then save it in your repo. You can view the list of stashes you made at any time!

Does git stash stash staged changes?

This option is only valid for push and save commands. Stash only the changes that are currently staged. This is similar to basic git commit except the state is committed to the stash instead of current branch.


Video Answer


2 Answers

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

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

like image 77
yibe Avatar answered Oct 06 '22 14:10

yibe


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.

like image 36
Ryan Le Avatar answered Oct 06 '22 13:10

Ryan Le