Kirk Strobeck
Kirk Strobeck

Reputation: 18669

Git stash apply and drop

Is there a git command that both applies the stash and removes it?

This as one command:

git stash apply
git stash drop

Upvotes: 56

Views: 16736

Answers (2)

Adam Wright
Adam Wright

Reputation: 49386

You want git stash pop!

pop [--index] [-q|--quiet] [<stash>]
       Remove a single stashed state from the stash list and apply it on
       top of the current working tree state, i.e., do the inverse
       operation of git stash save. The working directory must match the
       index.

Upvotes: 87

ellotheth
ellotheth

Reputation: 4523

git stash pop will take the first stash in your list (or the one you specify), apply it to your HEAD, and delete it from the stash list.

Upvotes: 26

Related Questions