Git: Perform a stash addition using a custom/meaningful message

Did you ever wonder “Is there more to git stash?”, we did!
We wanted to see if there is a way to manually set the stash message to something meaningful instead of the automated message that derives from the last commit.

Fortunately, there is the command git stash save "Meaningful message"; which allows you to add new changes in your stash and at the same time use a custom message.

By using the git stash save "custom message"; command you will be enhancing the results of the git stash list; command as it will contain more useful information for you.


$ git status;
On branch master
Changes not staged for commit:
 (use "git add <file>..." to update what will be committed)
 (use "git checkout -- <file>..." to discard changes in working directory)

modified: me

no changes added to commit (use "git add" and/or "git commit -a")
$ git stash save "custom message";
Saved working directory and index state On master: your message here
$ git stash list 
[email protected]{0}: On master: custom message
$ git stash show
 me | 1 +
 1 file changed, 1 insertion(+)

Leave a Reply