# [PATCH] git-stash: Display help message if git-stash is run without sub-commands

7 messages from 2007-11-30 to 2007-11-30. Participants: Kevin Leung, Mike Hommey, Wincent Colaiuta, Johannes Schindelin, Junio C Hamano, David Kastrup.
Thread: https://gitlist.dev/t/11065

## Kevin Leung, 2007-11-30 08:16

Subject: [PATCH] git-stash: Display help message if git-stash is run without sub-commands
Message-ID: <e66701d40711300016v15700deft3d262d75a9055aca@mail.gmail.com>
URL: https://gitlist.dev/e/e66701d40711300016v15700deft3d262d75a9055aca%40mail.gmail.com

```
The current git-stash behaviour is very error prone to typos. For example,
if you typed "git-stash llist", git-stash would thought that you wanted to
save to a stash named "llist", but in fact, you meant "git-stash list".

Signed-off-by: Kevin Leung <kevinlsk@gmail.com>
---
 git-stash.sh |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/git-stash.sh b/git-stash.sh
index 77c9421..dbb8894 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Copyright (c) 2007, Nanako Shiraishi

-USAGE='[ | list | show | apply | clear]'
+USAGE='[ save | list | show | apply | clear ]'

 SUBDIRECTORY_OK=Yes
 . git-sh-setup
@@ -195,6 +195,10 @@ show)
        shift
        show_stash "$@"
        ;;
+save)
+       shift
+       save_stash "$@" && git-reset --hard
+       ;;
 apply)
        shift
        apply_stash "$@"
@@ -202,14 +206,7 @@ apply)
 clear)
        clear_stash
        ;;
-help | usage)
-       usage
-       ;;
 *)
-       if test $# -gt 0 && test "$1" = save
-       then
-               shift
-       fi
-       save_stash "$*" && git-reset --hard
+       usage
        ;;
 esac
-- 
1.5.3.6.36.g38762

```

## Mike Hommey, 2007-11-30 08:41

Subject: Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands
Message-ID: <20071130084131.GA29668@glandium.org>
URL: https://gitlist.dev/e/20071130084131.GA29668%40glandium.org
In-Reply-To: <e66701d40711300016v15700deft3d262d75a9055aca@mail.gmail.com>

```
On Fri, Nov 30, 2007 at 04:16:34PM +0800, Kevin Leung <kevinlsk@gmail.com> wrote:
> The current git-stash behaviour is very error prone to typos. For example,
> if you typed "git-stash llist", git-stash would thought that you wanted to
> save to a stash named "llist", but in fact, you meant "git-stash list".

Still, 'git stash' alone should *do* the stash.

Mike

```

## Kevin Leung, 2007-11-30 09:09

Subject: Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands
Message-ID: <e66701d40711300109nc43f3efyb33e591af15a060b@mail.gmail.com>
URL: https://gitlist.dev/e/e66701d40711300109nc43f3efyb33e591af15a060b%40mail.gmail.com
In-Reply-To: <20071130084131.GA29668@glandium.org>

```
On Nov 30, 2007 4:41 PM, Mike Hommey <mh@glandium.org> wrote:
> Still, 'git stash' alone should *do* the stash.
>

How about `git stash' still does the stash, and `git stash llist'
exits with usage message? And if you want to save the stash with name,
you can only do it with `git stash save name_of_stash'.

Kevin Leung

```

## Wincent Colaiuta, 2007-11-30 09:19

Subject: Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands
Message-ID: <E1F9A2D0-F9BF-4548-8228-33A3F4984FBC@wincent.com>
URL: https://gitlist.dev/e/E1F9A2D0-F9BF-4548-8228-33A3F4984FBC%40wincent.com
In-Reply-To: <e66701d40711300109nc43f3efyb33e591af15a060b@mail.gmail.com>

```
El 30/11/2007, a las 10:09, Kevin Leung escribió:

> On Nov 30, 2007 4:41 PM, Mike Hommey <mh@glandium.org> wrote:
>> Still, 'git stash' alone should *do* the stash.
>
> How about `git stash' still does the stash, and `git stash llist'
> exits with usage message? And if you want to save the stash with name,
> you can only do it with `git stash save name_of_stash'.

That's probably the way it should have been all along.
>


Cheers,
Wincent

```

## Johannes Schindelin, 2007-11-30 11:50

Subject: Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands
Message-ID: <Pine.LNX.4.64.0711301149110.27959@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0711301149110.27959%40racer.site
In-Reply-To: <e66701d40711300016v15700deft3d262d75a9055aca@mail.gmail.com>

```
Hi,

On Fri, 30 Nov 2007, Kevin Leung wrote:

> The current git-stash behaviour is very error prone to typos. For 
> example, if you typed "git-stash llist", git-stash would thought that 
> you wanted to save to a stash named "llist", but in fact, you meant 
> "git-stash list".

I am fine with your patch.  I would be equally fine with "git stash" still 
choosing a default message and stashing.

And yes, I agree that the "git stash <whatever>" might be a little too 
error-prone.

Ciao,
Dscho

```

## Junio C Hamano, 2007-11-30 20:02

Subject: Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands
Message-ID: <7vr6i7qz6b.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vr6i7qz6b.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <e66701d40711300109nc43f3efyb33e591af15a060b@mail.gmail.com>

```
"Kevin Leung" <kevinlsk@gmail.com> writes:

> On Nov 30, 2007 4:41 PM, Mike Hommey <mh@glandium.org> wrote:
>> Still, 'git stash' alone should *do* the stash.
>>
>
> How about `git stash' still does the stash, and `git stash llist'
> exits with usage message? And if you want to save the stash with name,
> you can only do it with `git stash save name_of_stash'.

Sounds like a sensible thing to do.

```

## David Kastrup, 2007-11-30 20:11

Subject: Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands
Message-ID: <85mysvwl25.fsf@lola.goethe.zz>
URL: https://gitlist.dev/e/85mysvwl25.fsf%40lola.goethe.zz
In-Reply-To: <7vr6i7qz6b.fsf@gitster.siamese.dyndns.org>

```
Junio C Hamano <gitster@pobox.com> writes:

> "Kevin Leung" <kevinlsk@gmail.com> writes:
>
>> On Nov 30, 2007 4:41 PM, Mike Hommey <mh@glandium.org> wrote:
>>> Still, 'git stash' alone should *do* the stash.
>>>
>>
>> How about `git stash' still does the stash, and `git stash llist'
>> exits with usage message? And if you want to save the stash with name,
>> you can only do it with `git stash save name_of_stash'.
>
> Sounds like a sensible thing to do.

Instead of "save", one could use "stash" since that is what it is
supposed to do.  Then

git stash stash stash

would create a stash called "stash".

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

```
