From a5ab00c5d20cee04ce181bb5a6c3ca5d923744a4 Mon Sep 17 00:00:00 2001 From: Stephan Beyer Date: Sat, 16 Aug 2008 05:27:31 +0200 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- Documentation/git-stash.txt | 13 ++++++++++--- git-stash.sh | 8 +++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt index 7d50d74cc..49e2296a2 100644 --- a/Documentation/git-stash.txt +++ b/Documentation/git-stash.txt @@ -8,11 +8,13 @@ git-stash - Stash the changes in a dirty working directory away SYNOPSIS -------- [verse] -'git stash' list -'git stash' (show | apply | drop | pop ) [] +'git stash' list [] +'git stash' (show | drop | pop ) [] +'git stash' apply [--index] [] 'git stash' branch [] -'git stash' [save []] +'git stash' [save [--keep-index] []] 'git stash' clear +'git stash' create DESCRIPTION ----------- @@ -116,6 +118,11 @@ pop []:: of the current working tree state. When no `` is given, `stash@\{0}` is assumed. See also `apply`. +create:: + + Create a stash (which is a regular commit object) and return its + object name, without storing it anywhere in the ref namespace. + DISCUSSION ---------- diff --git a/git-stash.sh b/git-stash.sh index 5ad2c4b7a..e15c12abc 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -1,7 +1,13 @@ #!/bin/sh # Copyright (c) 2007, Nanako Shiraishi -USAGE='[ | save | list | show | apply | clear | drop | pop | create | branch ]' +dashless=$(basename "$0" | sed -e 's/-/ /') +USAGE="list [] + or: $dashless (show | drop | pop ) [] + or: $dashless apply [--index] [] + or: $dashless branch [] + or: $dashless [save [--keep-index] []] + or: $dashless clear" SUBDIRECTORY_OK=Yes OPTIONS_SPEC= -- 2.26.2