Re: [RFC] New command: 'git snapshot'.

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [RFC] New command: 'git snapshot'.

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:46:09

Jeff King [off-list ref] writes:
On Tue, Feb 10, 2009 at 06:40:34PM -0200, Fabio Augusto Dal Castel wrote:
quoted
Remember that 'stash' is actually TWO commands in one:
* Save current state
* Reset to HEAD

My primary reason to use snapshots is to AVOID the second step.
Doesn't that argue for "git stash --no-reset" or similar instead of a
separate command?
I also think adding options to "git stash" would be better than
creating a new command. The "git has too many commands" is already one
of the blocking factors for newcommers.

And indeed, I don't think the choice in the comparison table between
stash and snapshot should be all-or-nothing. There could be individual
options like --save-untracked, --per-branch, ... (--no-reset would
probably be redundant with stash create, but maybe stash create needs
a --keep-object-somewhere-in-a-reference like option). Then, having
"git snapshot" would just be a matter of creating the accurate alias.

-- 
Matthieu

Re: [RFC] New command: 'git snapshot'.

From: Fabio Augusto Dal Castel <hidden>
Date: 2016-06-15 22:46:09

Doesn't that argue for "git stash --no-reset" or similar instead of a
separate command?
Yes. And also for an "--untracked" (as already suggested).

Since stashes does not expire anymore (as correctly pointed by
Brandon), a snapshot could be reduced to an alias for:

git stash --no-reset --untracked

(except for the branch storage)


However, the rationale behind a new command was also to avoid the
'loss of identity' of stash (as currently implemented). I always saw
stash as a way to allow a temporary hack or a pull. If we start adding
a lot of switches into stash that ultimately would change its main
purpose, should it yet be called 'stash'? (something like a 'git
commit --no-commit' ?)

(Please, don't get me wrong: I'm just raising food for thoughts, here)

Maybe the 'stash' command and multiples switches would be more
appropriate if 'reset' was NOT the default behavior. Something like:

git stash [--untracked] [--reset]

where the current 'git stash' would be 'git stash --reset'.Of course,
this would be a significant breaking change.

I know... I know...  "Heresy!" You'd say... <g>

But... what about it? Why, after all, stash MUST do a reset?

"Do one thing. Do it well"?

Regards!
Fabio.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help