summaryrefslogtreecommitdiff
path: root/git-stash.sh
diff options
context:
space:
mode:
authorBrandon Casey <casey@nrlssc.navy.mil>2008-02-22 16:52:50 -0600
committerJunio C Hamano <gitster@pobox.com>2008-02-22 22:59:11 -0800
commitbd56ff54f710d463a6858bdc7ef6245f9ef30f42 (patch)
treeb25a0d4efe68d24b43d90c37dc84e7f6564909dc /git-stash.sh
parente25d5f9c82ef6a676de616bd28751cdfbcd53b15 (diff)
downloadgit-bd56ff54f710d463a6858bdc7ef6245f9ef30f42.tar.gz
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: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-xgit-stash.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/git-stash.sh b/git-stash.sh
index 5e3eb56791..c2b68205a2 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -1,7 +1,7 @@
#!/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 "$@"
;;
+pop)
+ shift
+ if apply_stash "$@"
+ then
+ test -z "$unstash_index" || shift
+ drop_stash "$@"
+ fi
+ ;;
*)
if test $# -eq 0
then