All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Andrew Wong <andrew.kw.w@gmail.com>
Cc: Marc Branchaud <marcnarc@xiplink.com>,
	"git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH 3/3] reset: Print a warning when user uses "git reset" during a merge
Date: Fri, 14 Mar 2014 13:55:44 -0700	[thread overview]
Message-ID: <xmqqa9csh54f.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CADgNjan9kCTMPczFzO4jQvM63EU4x7KnJKszhno5PjHivE9ENg@mail.gmail.com> (Andrew Wong's message of "Fri, 14 Mar 2014 13:04:42 -0400")

Andrew Wong <andrew.kw.w@gmail.com> writes:

> On Fri, Mar 14, 2014 at 10:33 AM, Marc Branchaud <marcnarc@xiplink.com> wrote:
>> I know this approach was suggested earlier, but given these dangers it seems
>> silly to give this big warning on a plain "git reset" but still go ahead and
>> do the things the warning talks about.
>>
>> Is there any issue with changing "git reset" to error-out now but letting
>> "git reset --mixed" proceed?  Something like (note the reworded warning message):
>
> Yeah, I would have preferred to have "git reset" error out right now,
> because the messed up work tree can be quite a pain to clean up. The
> main argument for issuing the warning is about maintaining
> compatibility.
>
> For the users that really did mean "--merge", the warning is silly.
> It's basically saying "We know that you're about to mess up your work
> tree, but we let you mess up anyway. Learn the correct way so that you
> don't mess up next time".

I suspect that you meant "--mixed" instead of "--merge" here.

I do not agree with the "We know that you are about to mess up"
above.  Whoever is issuing that warning message may not know better
than the user who is running "reset".  As you wrote "most likely not
what the user wants" in your proposed log message, the only thing we
know is that it _often_ is a newbie mistake.

I recently needed to manually cherry-pick only one half of a patch,
and the way I did so was

	git show $that_commit >P.diff
        git apply -3 P.diff
        ... conflicts are expected; that is why I used -3 in the
        ... first place
        git reset
        git diff HEAD
	edit
        ... edit away the other half I did not want to cherry-pick
        ... while fixing the conflicted parts that happened to be
        ... in the part I did want to cherry-pick

"git cherry-pick --no-commit $that_commit" could have been used as
a replacement for the first two steps but being able to run the
"reset" without erroring out was an essential part to make this
workflow usable.

So I am OK with "eventually error out by default", but not OK with
"we know better than the user and will not allow it at all".

  reply	other threads:[~2014-03-14 20:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14  4:37 [PATCH 0/3] Make git more user-friendly during a merge conflict Andrew Wong
2014-03-14  4:37 ` [PATCH 1/3] wt-status: Make status messages more consistent with others Andrew Wong
2014-03-17 21:51   ` Junio C Hamano
2014-03-14  4:37 ` [PATCH 2/3] merge: Advise user to use "git merge --abort" to abort merges Andrew Wong
2014-03-17 21:58   ` Junio C Hamano
2014-03-14  4:37 ` [PATCH 3/3] reset: Print a warning when user uses "git reset" during a merge Andrew Wong
2014-03-14 14:33   ` Marc Branchaud
2014-03-14 17:04     ` Andrew Wong
2014-03-14 20:55       ` Junio C Hamano [this message]
2014-03-14 21:35         ` Andrew Wong
2014-03-15 19:23         ` Marc Branchaud
2014-03-17 21:54   ` Junio C Hamano
2014-03-17 23:04 ` [PATCH 0/3] Make git more user-friendly during a merge conflict Junio C Hamano
2014-03-17 23:25   ` Andrew Wong
2014-03-19 22:30     ` 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=xmqqa9csh54f.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=andrew.kw.w@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=marcnarc@xiplink.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 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.