Commit bd56ff54 authored by Brandon Casey's avatar Brandon Casey Committed by Junio C Hamano

git-stash: add new 'pop' subcommand

This combines the existing stash subcommands 'apply' and 'drop' to
allow a single stash entry to be applied and then dropped, in other
words 'popped', from the stash list.
Signed-off-by: default avatarBrandon Casey <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent e25d5f9c
......@@ -8,7 +8,7 @@ git-stash - Stash the changes in a dirty working directory away
SYNOPSIS
--------
[verse]
'git-stash' (list | show [<stash>] | apply [<stash>] | clear | drop [<stash>])
'git-stash' (list | show [<stash>] | apply [<stash>] | clear | drop [<stash>] | pop [<stash>])
'git-stash' [save [<message>]]
DESCRIPTION
......@@ -90,6 +90,12 @@ drop [<stash>]::
Remove a single stashed state from the stash list. When no `<stash>`
is given, it removes the latest one. i.e. `[email protected]\{0}`
pop [<stash>]::
Remove a single stashed state from the stash list and apply on top
of the current working tree state. When no `<stash>` is given,
`[email protected]\{0}` is assumed. See also `apply`.
DISCUSSION
----------
......
#!/bin/sh
# Copyright (c) 2007, Nanako Shiraishi
USAGE='[ | save | list | show | apply | clear | drop | create ]'
USAGE='[ | save | list | show | apply | clear | drop | pop | create ]'
SUBDIRECTORY_OK=Yes
OPTIONS_SPEC=
......@@ -256,6 +256,14 @@ drop)
shift
drop_stash "[email protected]"
;;
pop)
shift
if apply_stash "[email protected]"
then
test -z "$unstash_index" || shift
drop_stash "[email protected]"
fi
;;
*)
if test $# -eq 0
then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment