Thread (21 messages) flat view 21 messages, 9 authors, 2016-06-15

Re: git-stash: RFC: Adopt the default behavior to other commands

From: Andreas Ericsson <hidden>
Date: 2016-06-15 22:44:00

Possibly related (same subject, not in this thread)

Jakub Narebski wrote:
Andreas Ericsson [off-list ref] writes:
quoted
Johannes Schindelin wrote:
quoted
On Tue, 18 Dec 2007, Andreas Ericsson wrote:
quoted
Johannes Schindelin wrote:
quoted
In the alternative, you could just scrap all those default
actions, showing synopses instead.  For all commands, including
"git commit", "git log", "git fetch", etc.
Like we do for the git wrapper, you mean? Yes, that would be one
solution, although not a very good one for all commands.
Exactly.  Not a good one.
quoted
It's probably not a bad idea for commands where the primary use is
something else than producing visual output though, such as tag or
branch, but those handle creation/deletion of stuff, so the default
action for them is to list stuff of the kind they operate on. I
fail to see why stash should be any different.
I also fail to see why stash should be any different.  And that's why
I expect it to have a default operation, which is -- you guessed it -- 
"stash the changes!"
Actually, I guessed "list the stashes".
quoted
If I am not sure what I am about to do, there is -- wonder of wonders -- 
the "-h" option!  And indeed:
	$ git stash -h
	Usage: /home/gitte/bin/git-stash [  | save | list | show |
apply | 		clear | create ]
So what exactly was your point again?
My point is that it would be nice if all git commands that actually
manipulate objects (create/delete/modify) had a safe default, and
that experienced users such as yourself could endure the insufferable
agony of retraining your fingers to type five more chars so that
people won't have to get bitten by surprises.
Also for "git commit"?
git commit has a very safe default; It runs "git status" and exits.
In my opinion _basic_ usage of git-stash is simply using it with
one stash only: "git stash" / "git unstash" (i.e. "git stash apply";
by the way this is one (beside "git view") use case for builtin
predefined aliases).  Using it with multiple stashes (only then
"git stash list" is needed) is advanced usage; and for advanced
usage longer form is preferred, I think.
Perhaps. I'll stop quibbling about it. I don't care very deeply
about it anyway.
"git branch", "git log" and "git remote" are horse of differenc color
because the _cannot_ function without name of branch/tag/remote given,
so hey provide "list" when no name was given.
git stash takes a name too. It's optional though, and has caused any
number of source lines to be rewritten by grumbling authors who just
started to like git a little less because of it (yes, I know that has
been fixed, but it makes me look twice when discussing defaults for
git stash).

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help