Skip to content

Commit a5ab00c

Browse files
sbeyergitster
authored andcommitted
git-stash: improve synopsis in help and manual page
"git stash -h" showed some incomplete and ugly usage information. For example, the useful "--keep-index" option for "save" or the "--index" option for "apply" were not shown. Also in the documentation synopsis they were not shown, so that there is no incentive to scroll down and even see that such options exist. This patch improves the git-stash synopsis in the documentation by mentioning that further options to the stash commands and then copies this synopsis to the usage information string of git-stash.sh. For the latter, the dashless git command string has to be inserted on the second and the following usage lines. The code of this is taken from git-sh-setup so that all lines will show the command string. Note that the "create" command is not advertised at all now, because it was not mentioned in git-stash.txt. Signed-off-by: Stephan Beyer <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0d768f7 commit a5ab00c

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Documentation/git-stash.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ git-stash - Stash the changes in a dirty working directory away
88
SYNOPSIS
99
--------
1010
[verse]
11-
'git stash' list
12-
'git stash' (show | apply | drop | pop ) [<stash>]
11+
'git stash' list [<options>]
12+
'git stash' (show | drop | pop ) [<stash>]
13+
'git stash' apply [--index] [<stash>]
1314
'git stash' branch <branchname> [<stash>]
14-
'git stash' [save [<message>]]
15+
'git stash' [save [--keep-index] [<message>]]
1516
'git stash' clear
17+
'git stash' create
1618

1719
DESCRIPTION
1820
-----------
@@ -116,6 +118,11 @@ pop [<stash>]::
116118
of the current working tree state. When no `<stash>` is given,
117119
`stash@\{0}` is assumed. See also `apply`.
118120

121+
create::
122+
123+
Create a stash (which is a regular commit object) and return its
124+
object name, without storing it anywhere in the ref namespace.
125+
119126

120127
DISCUSSION
121128
----------

git-stash.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
#!/bin/sh
22
# Copyright (c) 2007, Nanako Shiraishi
33

4-
USAGE='[ | save | list | show | apply | clear | drop | pop | create | branch ]'
4+
dashless=$(basename "$0" | sed -e 's/-/ /')
5+
USAGE="list [<options>]
6+
or: $dashless (show | drop | pop ) [<stash>]
7+
or: $dashless apply [--index] [<stash>]
8+
or: $dashless branch <branchname> [<stash>]
9+
or: $dashless [save [--keep-index] [<message>]]
10+
or: $dashless clear"
511

612
SUBDIRECTORY_OK=Yes
713
OPTIONS_SPEC=

0 commit comments

Comments
 (0)