Ad space (banner)
🌿Git Lessons
Lesson 58 / 59

Adding a Message to a Stash with git stash push -m

This lesson is for anyone who wants to attach a message to shelved work, using git stash push -m "work in progress". git stash push -m lets you stash with a message you'll be able to recognize later.

Use it in the form git stash push -m "message". Plain git stash alone can shelve things too, but giving a message with -m means it shows up with a recognizable name in the list from git stash list.

Running git stash push -m "work in progress" shelves your current changes, and git stash list now shows that shelved entry described as "work in progress."

A common early mistake is piling up multiple stashes without messages, until you can't tell which of stash@{0} or stash@{1} holds what — writing a purpose into -m each time prevents this.

In real practice, when temporarily shelving current work to handle an urgent interruption, it's common practice to always attach a message, so you don't mistake which one to restore later.

Git
Try it (type this into the pseudo terminal)
git stash push -m "work in progress"

🧑‍💻 You can type this command into the Git pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)