From: Kevin Bracey <kevin@bracey.fi>
To: Philip Oakley <philipoakley@iee.org>
Cc: Atsushi Nakagawa <atnak@chejz.com>, git@vger.kernel.org
Subject: Re: Reset by checkout?
Date: Mon, 09 Jun 2014 23:12:31 +0300 [thread overview]
Message-ID: <5396152F.4020704@bracey.fi> (raw)
In-Reply-To: <241E3E5EB7AE44E6821EA5DFAA24C28F@PhilipOakley>
On 07/06/2014 17:52, Philip Oakley wrote:
>
>
> Just to say there has been a similar confusion about 'git reset'
> reported on the Git Users group for the case of reset with added
> (staged), but uncommitted changes being wiped out, which simlarly
> reports on the difficulty of explaining some of the conditions
> especially when some are wrong ;-)
>
> https://groups.google.com/forum/#!topic/git-users/27_FxIV_100
I'm coming around to the view that "git reset <mode>" should be (almost)
demoted to plumbing, leaving only the "reset <file>" that reverses "add
<file>" as everyday Porcelain.
I think "reset --keep" and "--merge" were a step in the wrong direction,
at least for the Porcelain - trying to make reset <mode> "more useful",
rather than less necessary. Normal users shouldn't be needing to touch
these hard-to-explain-and-slightly-dangerous commands.
The addition of "--abort" to merge and other commands was much more
solid. They helped a lot, and I think we should follow that model by
adding "--undo" to various commands. That would mop up all the common
"reset"s, in conjunction with Atsushi's proposed "checkout -u"
alternative to -B, which I quite like.
Main few:
commit --undo = reset --soft HEAD^
merge --undo = reset --keep HEAD^
rebase --undo = reset --keep ORIG_HEAD [bug report: rebase -p doesn't
set ORIG_HEAD reliably]
pull --undo = merge/rebase --undo depending on rebase settings [could we
go nuts and undo the fetch too?]
Bonus:
commit --amend --undo: reset --soft HEAD@{1}
The undos can also have a bit of extra veneer that checks the log/reflog
for whether it matches the proposed undo, and also checks the upstream
to see if the thing being undone is already public.
Given those, I honestly don't think I'd ever need to explain git reset
<mode> to anyone again. Which would be nice...
(Note I propose no "--mixed" equivalent for the commit undos, but it's
easy enough to follow the "commit --undo" with a normal "git reset". I'd
rather re-document the normal git reset under "commit --undo" than add
and document yet another option).
Kevin
next prev parent reply other threads:[~2014-06-09 23:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-31 5:46 Reset by checkout? Atsushi Nakagawa
2014-05-31 7:03 ` Andreas Schwab
2014-06-01 2:56 ` Atsushi Nakagawa
2014-05-31 7:27 ` Kevin Bracey
2014-06-01 4:26 ` Atsushi Nakagawa
2014-06-01 8:45 ` Kevin Bracey
2014-06-02 21:54 ` Junio C Hamano
2014-06-03 19:48 ` Kevin Bracey
2014-06-03 21:48 ` Felipe Contreras
2014-06-07 4:54 ` Atsushi Nakagawa
2014-06-07 14:52 ` Philip Oakley
2014-06-09 20:12 ` Kevin Bracey [this message]
2014-06-07 4:55 ` Atsushi Nakagawa
2014-05-31 10:56 ` Felipe Contreras
2014-05-31 23:39 ` Felipe Contreras
2014-06-01 4:58 ` Atsushi Nakagawa
2014-06-02 21:29 ` Junio C Hamano
2014-06-02 21:31 ` Junio C Hamano
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=5396152F.4020704@bracey.fi \
--to=kevin@bracey.fi \
--cc=atnak@chejz.com \
--cc=git@vger.kernel.org \
--cc=philipoakley@iee.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.