Create a stash

Git, Repository, Stash · Apr 13, 2021

Saves the current state of the working directory and index into a new stash.

  • Use git stash save to save the current state of the working directory and index into a new stash.
  • You can optionally use the -u option to include untracked files.
  • You can optionally provide a <message> for the stash.
git stash save [-u] [<message>]
git stash save
# Creates a new stash

git stash save -u
# Creates a new stash, including untracked files

git stash save "Bugfix WIP"
# Creates a new stash with the message "Bugfix WIP"

Written by Angelos Chalaris

I'm Angelos Chalaris, a JavaScript software engineer, based in Athens, Greece. The best snippets from my coding adventures are published here to help others learn to code.

If you want to keep in touch, follow me on GitHub.

More like this

  • Create a new repository

    Initializes a new git repository, setting up all the configuration files needed by git.

    Git, Repository · Apr 13, 2021

  • Merge a branch in Git

    Learn how to merge a branch in Git with or without creating a merge commit, depending on your team's workflow.

    Git, Repository · May 26, 2023

  • View Git "undo" history

    Learn how to view your "undo" history using git reflog and reset your repository to a previous state.

    Git, Repository · May 21, 2023