summaryrefslogtreecommitdiff
path: root/git-stash.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2009-07-27 20:37:10 +0200
committerJunio C Hamano <gitster@pobox.com>2009-07-31 07:33:06 -0700
commitea41cfc4f54f884582dbda307287f12bb1fc15e9 (patch)
tree390b7e770faea618226d4841ecd127563e1192f6 /git-stash.sh
parent6517452d7a4269e9a34648a28b8931640299f458 (diff)
downloadgit-ea41cfc4f54f884582dbda307287f12bb1fc15e9.tar.gz
Make 'git stash -k' a short form for 'git stash save --keep-index'
To save me from the carpal tunnel syndrome, make 'git stash' accept the short option '-k' instead of '--keep-index', and for even more convenience, let's DWIM when this developer forgot to type the 'save' command. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-xgit-stash.sh16
1 files changed, 9 insertions, 7 deletions
diff --git a/git-stash.sh b/git-stash.sh
index 03e589f764..13edc0eefd 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -7,7 +7,8 @@ USAGE="list [<options>]
or: $dashless drop [-q|--quiet] [<stash>]
or: $dashless ( pop | apply ) [--index] [-q|--quiet] [<stash>]
or: $dashless branch <branchname> [<stash>]
- or: $dashless [save [--keep-index] [-q|--quiet] [<message>]]
+ or: $dashless [save [-k|--keep-index] [-q|--quiet] [<message>]]
+ or: $dashless [-k|--keep-index]
or: $dashless clear"
SUBDIRECTORY_OK=Yes
@@ -98,7 +99,7 @@ save_stash () {
while test $# != 0
do
case "$1" in
- --keep-index)
+ -k|--keep-index)
keep_index=t
;;
-q|--quiet)
@@ -353,12 +354,13 @@ branch)
apply_to_branch "$@"
;;
*)
- if test $# -eq 0
- then
- save_stash &&
+ case $#,"$1" in
+ 0,|1,-k|1,--keep-index)
+ save_stash "$@" &&
say '(To restore them type "git stash apply")'
- else
+ ;;
+ *)
usage
- fi
+ esac
;;
esac