LinuxCommandLibrary

git-stash

Temporarily save uncommitted changes for later

TLDR

Stash changes

$ git stash
copy
Stash with message
$ git stash push -m "[message]"
copy
List stashes
$ git stash list
copy
Apply latest stash
$ git stash apply
copy
Pop latest stash
$ git stash pop
copy
Apply specific stash
$ git stash apply stash@{[n]}
copy
Show stash contents
$ git stash show -p
copy
Drop a stash
$ git stash drop stash@{[n]}
copy
Clear all stashes
$ git stash clear
copy

SYNOPSIS

git stash command [options]

DESCRIPTION

git stash temporarily shelves uncommitted changes so you can work on something else. It saves both staged and unstaged modifications, then reverts the working directory to match HEAD.
Use `pop` to restore and remove a stash, or `apply` to restore while keeping it. Stashes are stored as a stack, with the most recent at `stash@{0}`.

PARAMETERS

-m, --message msg

Stash message.
-u, --include-untracked
Include untracked files.
-a, --all
Include ignored files.
-p, --patch
Interactive stashing.

SUBCOMMANDS

push

Stash changes.
list
List stashes.
show
Show stash contents.
apply
Apply without removing.
pop
Apply and remove.
drop
Remove a stash.
clear
Remove all stashes.
branch
Create branch from stash.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community