git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Sergey Organov <sorganov@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, Johannes Sixt <j6t@kdbg.org>,
	"B. Stebler" <bono.stebler@gmail.com>,
	git@vger.kernel.org
Subject: Re: Improving merge of tricky conflicts
Date: Fri, 24 Jul 2020 09:53:49 +0300	[thread overview]
Message-ID: <874kpxwghu.fsf@osv.gnss.ru> (raw)
In-Reply-To: xmqqimedq5c8.fsf@gitster.c.googlers.com

Junio C Hamano <gitster@pobox.com> writes:

> Sergey Organov <sorganov@gmail.com> writes:
>
>>> You can also do it after "git merge" aborts with conflicts by running:
>>>
>>>   git checkout --conflict=diff3 my-file
>>>
>>> but do note that it will check out from the index, overwriting any
>>> resolution you've already done in that file.
>>
>> Though now it gets really odd "git merge" itself doesn't have this
>> option.
>
> A command line option is cumbersome that you have to type it every
> time, so configuration variable makes 100% more sense than an option
> to "git merge".

Fortunately Git already supports configuration variable, that we both
agree is a nice thing to have, so I won't have to type the option every
time, no.

> If your merge used the merge (as opposed to diff3) style, and seeing
> that the resulting conflict is not easy to review and you wish you
> used diff3 style instead, it is way too late for any option to "git
> merge" to help you.

  $ git merge --abort
  $ git merge --conflict=diff3 side-branch

or, say, entirely imaginary:

  $ git merge --redo --conflict=diff3 side-branch -- my-file

if merge had --redo option and path limiting support, that could be
handy for other reasons as well, as I have already pointed elsewhere and
you disagreed, but still.

>
> But having an option to "git checkout" lets you move forward from
> that state, so it also makes 100% more sense than an option to "git
> merge".

Actually, "git checkout" is not the place where I'd expect to find this
feature in the first place, so to me it's rather already 99%
illogical.

If "git merge" is what gave me the original result, it's some "git
merge" variant that I'd expect to give me modified result as well.

Yeah, I can see how Git machinery is an excuse for "git checkout" to end
up being used for this feature, but only after I learned it is.

> So, it is not odd at all.  Just compare between merge and diff3,
> think which one would often help you, configure to use it by default,
> *and* at a rare occasion where the chosen default does not work for
> you, let "checkout" help you.  The thing is, unless you first attempt
> to "git merge", you won't know what shape of conflict you would get,
> so you cannot choose the right conflict style command line option,
> even if one were available.

What looks odd to me is that for "git merge" I need to use:

   $ git -c merge.conflictstyle=diff3 merge side-branch

as you yourself pointed, whereas for "git checkout" I can use:

   $ git checkout --conflict=diff3 my-file

even though it could have been:

   $ git -c merge.conflictstyle=diff3 checkout -m my-file

as far as I can tell. A minor inconsistency, but still.

If I got your arguments right, you think that having short-cut option
for "git checkout" makes sense, while having similar one for "git merge"
doesn't, whereas my argument is that either both make sense, or both
don't.

Anyway, it's nice we can still do these things, one way or another.

Thanks,
-- Sergey

  parent reply	other threads:[~2020-07-24  6:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21 23:29 Improving merge of tricky conflicts B. Stebler
2020-07-22  5:50 ` Johannes Sixt
2020-07-22  7:45   ` Jeff King
2020-07-22 17:26     ` Junio C Hamano
2020-07-23 18:25       ` Jeff King
2020-07-24  1:19         ` Junio C Hamano
2020-07-24 19:48           ` Jeff King
2020-07-24 20:18             ` Junio C Hamano
2021-01-16  2:50         ` Martin von Zweigbergk
2021-01-21 14:28           ` Jeff King
2021-01-21 20:30             ` Martin von Zweigbergk
2021-01-21 21:08               ` Jeff King
2020-07-22 20:17   ` Sergey Organov
2020-07-22 21:14     ` Junio C Hamano
2020-07-22 21:20       ` Sergey Organov
2020-07-23 18:26         ` Jeff King
2020-07-23 19:11           ` Sergey Organov
2020-07-23 21:39             ` Junio C Hamano
2020-07-24  5:15               ` Jacob Keller
2020-07-24  6:01                 ` Junio C Hamano
2020-07-24  6:53               ` Sergey Organov [this message]
2020-07-24 20:30                 ` Junio C Hamano
2020-07-24 22:11                   ` Sergey Organov
2020-07-24 23:04                     ` Junio C Hamano
2020-07-22 22:48   ` Bono Stebler

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=874kpxwghu.fsf@osv.gnss.ru \
    --to=sorganov@gmail.com \
    --cc=bono.stebler@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=peff@peff.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).