Skip to content

Commit 5ba2831

Browse files
peffgitster
authored andcommitted
stash: recognize "--help" for subcommands
If you run "git stash --help", you get the help for stash (this magic is done by the git wrapper itself). But if you run "git stash drop --help", you get an error. We cannot show help specific to "stash drop", of course, but we can at least give the user the normal stash manpage. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d6cc2df commit 5ba2831

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

git-stash.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ save_stash () {
219219
-a|--all)
220220
untracked=all
221221
;;
222+
--help)
223+
show_help
224+
;;
222225
--)
223226
shift
224227
break
@@ -307,6 +310,11 @@ show_stash () {
307310
git diff ${FLAGS:---stat} $b_commit $w_commit
308311
}
309312

313+
show_help () {
314+
exec git help stash
315+
exit 1
316+
}
317+
310318
#
311319
# Parses the remaining options looking for flags and
312320
# at most one revision defaulting to ${ref_stash}@{0}
@@ -373,6 +381,9 @@ parse_flags_and_rev()
373381
--index)
374382
INDEX_OPTION=--index
375383
;;
384+
--help)
385+
show_help
386+
;;
376387
-*)
377388
test "$ALLOW_UNKNOWN_FLAGS" = t ||
378389
die "$(eval_gettext "unknown option: \$opt")"

0 commit comments

Comments
 (0)