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?
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.
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!
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.
You can directly edit the messages stored in .git/logs/refs/stash
.
I know it's probably not ideal, but should work anyway.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With