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 [save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet] [-u|--include-untracked] [-a|--all] [<message>]]
git stash clear
git stash create [<message>]
git stash store [-m|--message <message>] [-q|--quiet] <commit>
Parameter | Details |
---|---|
show | Show the changes recorded in the stash as a diff between the stashed state and its original parent. When no <stash> is given, shows the latest one. |
list | List the stashes that you currently have. Each stash is listed with its name (e.g. stash@{0} is the latest stash, stash@{1} is the one before, etc.), the name of the branch that was current when the stash was made, and a short description of the commit the stash was based on. |
pop | Remove a single stashed state from the stash list and apply it on top of the current working tree state. |
apply | Like pop , but do not remove the state from the stash list. |
clear | Remove all the stashed states. Note that those states will then be subject to pruning, and may be impossible to recover. |
drop | Remove a single stashed state from the stash list. When no <stash> is given, it removes the latest one. i.e. stash@{0}, otherwise <stash> must be a valid stash log reference of the form stash@{<revision>}. |
create | Create a stash (which is a regular commit object) and return its object name, without storing it anywhere in the ref namespace. This is intended to be useful for scripts. It is probably not the command you want to use; see "save" above. |
store | Store a given stash created via git stash create (which is a dangling merge commit) in the stash ref, updating the stash reflog. This is intended to be useful for scripts. It is probably not the command you want to use; see "save" above. |
Stashing allows us to have a clean working directory without losing any information. Then, it's possible to start working on something different and/or to switch branches.