aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-04-06 15:42:50 -0700
committerJunio C Hamano <gitster@pobox.com>2026-04-06 15:42:50 -0700
commita2dc76525117e69f19afb54fec298f3d9ef76499 (patch)
tree86c3405a883c1064b9fbdc5dfa5bf132420ed7ef
parente44fbc2afa6970f08bdce307f0d52b880d4decaa (diff)
parent3402850ee16f5a7a05d68cb29271a0e558659aaa (diff)
downloadgit-a2dc76525117e69f19afb54fec298f3d9ef76499.tar.xz
Merge branch 'qb/doc-git-stash-push-optionality'
Doc update. * qb/doc-git-stash-push-optionality: docs: fix "git stash [push]" documentation
-rw-r--r--Documentation/git-stash.adoc10
-rw-r--r--builtin/stash.c4
2 files changed, 6 insertions, 8 deletions
diff --git a/Documentation/git-stash.adoc b/Documentation/git-stash.adoc
index 235d57ddd8..b05c990ecd 100644
--- a/Documentation/git-stash.adoc
+++ b/Documentation/git-stash.adoc
@@ -14,10 +14,10 @@ git stash drop [-q | --quiet] [<stash>]
git stash pop [--index] [-q | --quiet] [<stash>]
git stash apply [--index] [-q | --quiet] [<stash>]
git stash branch <branchname> [<stash>]
-git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
+git stash [push] [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
[-u | --include-untracked] [-a | --all] [(-m | --message) <message>]
[--pathspec-from-file=<file> [--pathspec-file-nul]]
- [--] [<pathspec>...]]
+ [--] [<pathspec>...]
git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
[-u | --include-untracked] [-a | --all] [<message>]
git stash clear
@@ -60,10 +60,8 @@ COMMANDS
the description along with the stashed state.
+
For quickly making a snapshot, you can omit "push". In this mode,
-non-option arguments are not allowed to prevent a misspelled
-subcommand from making an unwanted stash entry. The two exceptions to this
-are `stash -p` which acts as alias for `stash push -p` and pathspec elements,
-which are allowed after a double hyphen `--` for disambiguation.
+pathspec elements are only allowed after a double hyphen `--`
+to prevent a misspelled subcommand from making an unwanted stash entry.
`save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-u | --include-untracked] [-a | --all] [-q | --quiet] [<message>]`::
diff --git a/builtin/stash.c b/builtin/stash.c
index 95c5005b0b..0d27b2fb1f 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -50,10 +50,10 @@
#define BUILTIN_STASH_STORE_USAGE \
N_("git stash store [(-m | --message) <message>] [-q | --quiet] <commit>")
#define BUILTIN_STASH_PUSH_USAGE \
- N_("git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
+ N_("git stash [push] [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
" [-u | --include-untracked] [-a | --all] [(-m | --message) <message>]\n" \
" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n" \
- " [--] [<pathspec>...]]")
+ " [--] [<pathspec>...]")
#define BUILTIN_STASH_SAVE_USAGE \
N_("git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
" [-u | --include-untracked] [-a | --all] [<message>]")