git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Martin Langhoff <martin.langhoff@gmail.com>
Cc: Wincent Colaiuta <win@wincent.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: git-stash: RFC: Adopt the default behavior to other commands
Date: Wed, 19 Dec 2007 12:01:54 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0712191150240.23902@racer.site> (raw)
In-Reply-To: <46a038f90712182346t5309448egebfd3726f4d493c5@mail.gmail.com>

Hi,

On Wed, 19 Dec 2007, Martin Langhoff wrote:

> On Dec 19, 2007 8:33 PM, Wincent Colaiuta <win@wincent.com> wrote:
> > El 19/12/2007, a las 0:41, Martin Langhoff escribi?:
> >
> > > On Dec 19, 2007 4:42 AM, J?rg Sommer <joerg@alea.gnuu.de> wrote:
> > >> I vote for stash print the list, because I dropped in the pitfall.
> > >
> > > I've dropped there myself, and work with a large team where we are 
> > > both fans of stash, and scarred by it. Any newcomer to git that 
> > > "discovers" stash gets hit by it a dozen times, this is completely 
> > > unnecesary.
> >
> > I may be missing something here, but what's the danger here? An
> 
> Surprise. Your working directory has *just* changed under your feet. 
> Maybe you have an editor with further unsaved changes that is about to 
> act confused whether you undo the stash or not.

The funny thing: why do you call stash with unsaved changes anyway?  I 
mean, come on, even if you were planning to see the usage of stash (which 
you would get with -h), you undoubtedly wanted to either stash or unstash 
some changes.  Otherwise you would not _need_ to see the usage to begin 
with.

> > unexpected stash is incredibly easy to revert, unless I'm missing
> 
> Once you know about it, yes it is. Once you know about the reflog, you
> can sing and dance and never be worried. But for starting users, it's
> a dangerous command.

No.

Reflogs have nothing to do with it.

If you want to stash changes, you _got_ to know how to unstash those 
changes.  Otherwise "git reset --hard" would have been your friend.

And so, I cannot help but believe that all users of stash -- even the new 
ones -- know about the fundamental concept of stashing/unstashing, and 
therefore it is more something like this:

	$ git stash
	[no usage?  What the heck... Oh, it stashed the changes.  I did 
	 not want to stash them just yet.  Okay:]
	$ git unstash
	No such command
	[Oh, maybe I should have read the man page.  Oh, well, the usage 
	 should do...]
	$ git stash -h
	...

Yes, if you start "git stash" blindly, believing that it does what "git 
stash -h" does, you will be bitten by it once.

But as I said, you will be bitten by a plenty commands if you are not 
familiar with the concept that "-h" shows the synopsis, "--help" the man 
page, and that there is a default action where possible.

But stash really is about things like

	$ git stash
	$ git pull
	$ git stash apply

I do not _want_ to see the stash list in _most_ cases, because I do not 
stash away million dirty changes.

And that workflow was what "git stash" was designed for.

> > And nobody commented on the idea I posted earlier which seems to 
> > address the concerns about newbies not knowing what "git stash" with 
> > no params does:
> 
> I agree with making stash more verbose -- if the unlucky new user is
> paying close attention, they'll have instructions on to how to get out
> of trouble. But I agree more with making it "just verbose, no action"
> by default. There are two strong hints:
> 
>  - all other state-changing commands take parameters

What about "git commit", "git reset", "git fetch"?  These definitely 
change state of the repository.

>  - quite a few people in this list have gotten burned with it

Okay, let's have a little calculation: IIRC 3 people (let's make it 10, to 
be conservative) have said that they had this problem.  I must assume that 
all other people did not have the problem, or at least saw why the default 
action of "git stash" is what it is.

That said, if you _have_ to have the default changed, then I'll probably 
implement a "git push" and "git pop" alias here, so that I cannot get 
annoyed by stash's "new and improved" behaviour.

Ciao,
Dscho

  parent reply	other threads:[~2007-12-19 12:02 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-17 11:03 git-stash: RFC: Adopt the default behavior to other commands Sebastian Harl
2007-12-17 22:32 ` Benoit Sigoure
2007-12-17 23:00   ` Junio C Hamano
2007-12-17 23:32     ` Benoit Sigoure
2007-12-18  0:31       ` Junio C Hamano
2007-12-18 10:59         ` Sebastian Harl
2007-12-18 12:33           ` Johannes Schindelin
2007-12-18 14:22             ` Andreas Ericsson
2007-12-18 14:47               ` Johannes Schindelin
2007-12-18 15:00                 ` Andreas Ericsson
2007-12-18 15:15                   ` Johannes Schindelin
2007-12-18 15:28                     ` Andreas Ericsson
2007-12-18 15:40                       ` Jakub Narebski
2007-12-18 16:06                         ` Andreas Ericsson
2007-12-18 16:11                           ` Johannes Schindelin
2007-12-18 17:40                             ` Sergei Organov
2007-12-18 18:03                               ` Johannes Schindelin
2007-12-18 23:31                                 ` Martin Langhoff
2007-12-18 15:28               ` Wincent Colaiuta
2007-12-18 15:42         ` Jörg Sommer
2007-12-18 22:13           ` Johannes Schindelin
2007-12-18 22:22           ` Junio C Hamano
2007-12-20 21:40             ` しらいしななこ
2007-12-20 22:31               ` Junio C Hamano
2007-12-21  7:59                 ` Wincent Colaiuta
2007-12-21  8:40                 ` しらいしななこ
2007-12-18 23:32           ` André Goddard Rosa
2007-12-18 23:41           ` Martin Langhoff
2007-12-19  7:33             ` Wincent Colaiuta
2007-12-19  7:46               ` Martin Langhoff
2007-12-19  8:29                 ` Andreas Ericsson
2007-12-19 12:01                 ` Johannes Schindelin [this message]
2007-12-19 12:07                   ` Wincent Colaiuta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0712191150240.23902@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=martin.langhoff@gmail.com \
    --cc=win@wincent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).