Skip to content

Commit 3402850

Browse files
Sporarumgitster
authored andcommitted
docs: fix "git stash [push]" documentation
Both the synopsis and explanation are incorrect and contradict each other. The synopsis claims "push" can only be omitted when you do not give any options and arguments. The explanation correctly claims that non-option arguments are not allowed, except pathspec elements preceded by double hyphens. But it also adds "-p" to the list of exceptions, even though it is an option argument. Signed-off-by: Quentin Bernet <quentin.bernet@bluewin.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 5361983 commit 3402850

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

Documentation/git-stash.adoc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ git stash drop [-q | --quiet] [<stash>]
1414
git stash pop [--index] [-q | --quiet] [<stash>]
1515
git stash apply [--index] [-q | --quiet] [<stash>]
1616
git stash branch <branchname> [<stash>]
17-
git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
17+
git stash [push] [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
1818
[-u | --include-untracked] [-a | --all] [(-m | --message) <message>]
1919
[--pathspec-from-file=<file> [--pathspec-file-nul]]
20-
[--] [<pathspec>...]]
20+
[--] [<pathspec>...]
2121
git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
2222
[-u | --include-untracked] [-a | --all] [<message>]
2323
git stash clear
@@ -60,10 +60,8 @@ COMMANDS
6060
the description along with the stashed state.
6161
+
6262
For quickly making a snapshot, you can omit "push". In this mode,
63-
non-option arguments are not allowed to prevent a misspelled
64-
subcommand from making an unwanted stash entry. The two exceptions to this
65-
are `stash -p` which acts as alias for `stash push -p` and pathspec elements,
66-
which are allowed after a double hyphen `--` for disambiguation.
63+
pathspec elements are only allowed after a double hyphen `--`
64+
to prevent a misspelled subcommand from making an unwanted stash entry.
6765

6866
`save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-u | --include-untracked] [-a | --all] [-q | --quiet] [<message>]`::
6967

builtin/stash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
#define BUILTIN_STASH_STORE_USAGE \
5151
N_("git stash store [(-m | --message) <message>] [-q | --quiet] <commit>")
5252
#define BUILTIN_STASH_PUSH_USAGE \
53-
N_("git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
53+
N_("git stash [push] [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
5454
" [-u | --include-untracked] [-a | --all] [(-m | --message) <message>]\n" \
5555
" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n" \
56-
" [--] [<pathspec>...]]")
56+
" [--] [<pathspec>...]")
5757
#define BUILTIN_STASH_SAVE_USAGE \
5858
N_("git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
5959
" [-u | --include-untracked] [-a | --all] [<message>]")

0 commit comments

Comments
 (0)