git stash with a message



~1 min read


157 words

Adding a message to a stash is a great way to easily identify what’s included in a stash.

This can be particularly helpful if you’re only stashing specific files.

How to add a message to a git stash:

Use the flag --message (or -ml) that’s available for the git stash push command. As always, use the git stash --help to see the manual and get more ideas for how to use it.

Here’s what that might look like

$ git stash push --message "backend tweak"  api
Saved working directory and index state On master: backend-tweak
$ git stash list
stash@{0}: On master: backend tweak

A few things to note

  1. Notice the order here - git stash push says what you’re going to do.
  2. --message "a string goes here" says what you’d like to label the stash as
  3. api means anything with a path starting with api (this is optional)

Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!