This is an old revision of the document!


Basic operation of git stash, which allows you to save uncommitted work, and recover it later.

git stash list [<options>]
git stash show [<stash>]
git stash drop [-q|--quiet] [<stash>]
git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
git stash branch <branchname> [<stash>]
git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
             [-u|--include-untracked] [-a|--all] [-m|--message <message>]
             [--] [<pathspec>...]]
git stash clear
git stash create [<message>]
git stash store [-m|--message <message>] [-q|--quiet] <commit>

Save both the unstaged and staged content in a new stash:

$ git stash push

then display the current list of stashes:

$ git stash list
stash@{0}: WIP on master: 40e196a906d9 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
$

Significant options for git stash push:

  • [-m,--message]: Add an informative stashing message
  • --keep-index: Remember what was already staged versus what wasn't
  • --include-untracked: Stash untracked, unignored files, then clean
  • --all: Stash all untracked files, including ignored ones, then clean
  • git_stash.1550681577.txt.gz
  • Last modified: 2019/02/20 16:52
  • by rpjday