git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vicarel <shundra8820@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Why does "merge --continue" expect no arguments?
Date: Tue, 21 Dec 2021 12:51:19 -0500	[thread overview]
Message-ID: <CALRdAffjmvHao8TRfB9YJez1acwHDAq2ZqiqaCRRr5MaWzhxig@mail.gmail.com> (raw)
In-Reply-To: <xmqqlf0dq3t3.fsf@gitster.g>

Thank you so much for the detailed response! Brief side note...this is
my first time posting on the git mailing list (or any mailing list of
this kind!), so please educate me if I'm incorrectly quoting, using
reply/CC, or formatting lines (not sure if the mail server
automatically wraps lines after 72 chars)...

Junio C Hamano <gitster@pobox.com> writes:
> Compared to a merge that cleanly auto-resolved, in a conflicted
> merge, you have one more thing worth explaining to future readers of
> "git log"---how and why the work on the side branch conflicted with
> the work on the mainline, and how you chose to resolve it.

Fair point. I would argue that in my own personal projects, where I am
the only contributor, sometimes I just want to accept the default
merge message and move on.  However, one could apply that reasoning to
_every_ commit message in a personal project, and I certainly don't
believe in that... so yeah, you've given me something to think about.

Junio C Hamano <gitster@pobox.com> writes:
> The way to finish a conflicted merge has always been to run "git
> commit" before "merge --continue" was added, and it still is not
> just accepted but is the right way to finish a conflicted merge.

That makes sense. TBH, I assumed that `merge --continue` _was_ the
preferred way to finish merging after conflicts simply b/c the option
exists! `commit --no-edit` definitely meets my immediate needs though,
so thank you for that suggestion.

Junio C Hamano <gitster@pobox.com> writes:
> [...] possible next steps, i.e.
>
> * deprecate and eventually remove "merge --continue"
> * deprecate and eventually rename "merge --continue" to "merge --finish"
> * add "--no-edit" to "merge --continue"
> [...]
> * document more clearly that "merge --continue" is a mere synonym
>  for, and hint that there is no reason to favor it over, "git
>  commit".

I agree that some clearer documentation around `merge --continue` is
worthwhile, to prevent other developers from thinking like myself.
Maybe a warning from the CLI after running `merge --continue`,
recommending `commit` usage instead? Such a warning suggests that the
option _should_ still be deprecated and removed in the future though.

I am still interested in making a contribution to git, so let me know
which option you would like me to move forward with at this time:
adding the CLI warning, or going straight to a deprecation. Unless of
course you're already on it. :)


On Tue, Dec 21, 2021 at 12:13 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Daniel Vicarel <shundra8820@gmail.com> writes:
>
> > There are several git commands that take a "--continue"
> > option...`merge`, `rebase`, `cherry-pick`, etc. From looking through
> > the source though, only `merge --continue` seems to expect no other
> > arguments. Suppose that you have just resolved some merge conflicts,
> > and then want to run `git merge --continue --no-edit` to accept the
> > default merge commit message. Having to open/close the configured text
> > editor still is mildly annoying. I'm interested in submitting a patch
> > to "fix" this `merge` behavior, but I wanted to check if this was
> > really the intended behavior first, and if so why.
>
> The answer lies somewhere between "it is very much deliberate" and
> "'merge --continue' is so unimportant that nobody bothered".
>
> Originally, our "merge" did not open an editor to give you a chance
> to explain why you are merging a side branch when recording a
> cleanly auto-resolved result.  In fact, it didn't even have an
> "--edit" option to optionally allow you to edit.  This changed at
> f8246281 (merge: use editor by default in interactive sessions,
> 2012-01-10); its log message is worth a read to understand the
> issues.
>
> Compared to a merge that cleanly auto-resolved, in a conflicted
> merge, you have one more thing worth explaining to future readers of
> "git log"---how and why the work on the side branch conflicted with
> the work on the mainline, and how you chose to resolve it.
>
> So, in that sense, we would very much want to do whatever possible
> to encourage you to write a good log message.  Opening an editor is
> one step in that direction.
>
> Among the commands with "--continue", "merge --continue" came much
> later, and it did not even need to exist.  The other commands with
> "--continue", e.g. "rebase", deal with multi-step operations, and it
> is worth to have a way to say "I am finished with this step, let's
> CONTINUE WITH THE REST".  But in "merge", there is no remaining
> thing to do after you are done with the conflict you saw.
>
> In hindsight, we probably should have resisted the urge to add
> "merge --continue", just for the sake of misguided "consistency"
> perceived on non-existent similarity with other commands that truly
> need "--continue".  What is called "merge --continue" should have
> been called "merge --finish", if we needed to add something back
> then.
>
> The way to finish a conflicted merge has always been to run "git
> commit" before "merge --continue" was added, and it still is not
> just accepted but is the right way to finish a conflicted merge.
>
> So, in that sense, "merge --continue" is so unimportant that it is
> understandable that nobody bothered.
>
> So I guess that makes two discouraging factors against adding
> "--no-edit" to "merge --continue".  It encourages a wrong behaviour
> of under-explaining the result of your work, and "commit" is a much
> shorter way to say "merge --continue" anyway.
>
> In fact, "merge --continue --no-edit" is much longer to type than
> "commit --no-edit".
>
> merge --continue
> commit --no-edit
>
> Having said all that, among various things that the above discussion
> suggests as possible next steps, i.e.
>
>  * deprecate and eventually remove "merge --continue"
>  * deprecate and eventually rename "merge --continue" to "merge --finish"
>  * add "--no-edit" to "merge --continue"
>
> I think the last one might be the change with least impact and
> resistance.  Those who are unaware that "commit --no-edit" suffices
> would end up typing a lot more and wasting their keyswitches' life,
> but the damage is limited ;-)
>
> Or we could throw in another
>
>  * document more clearly that "merge --continue" is a mere synonym
>    for, and hint that there is no reason to favor it over, "git
>    commit".
>
> which happens to be my favourite so far after thinking the above
> through.
>
> Thanks.



-- 

Dan Vicarel

  reply	other threads:[~2021-12-21 17:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21 14:50 Why does "merge --continue" expect no arguments? Daniel Vicarel
2021-12-21 17:13 ` Junio C Hamano
2021-12-21 17:51   ` Daniel Vicarel [this message]
2021-12-21 17:54     ` Daniel Vicarel
2021-12-22  6:20     ` Junio C Hamano
2021-12-21 17:57   ` Philip Oakley
2021-12-24 17:08   ` Ævar Arnfjörð Bjarmason
2021-12-25  2:01     ` Junio C Hamano
2021-12-26 23:31       ` Ævar Arnfjörð Bjarmason
2021-12-27 19:29         ` Junio C Hamano
     [not found] ` <CAFOYHZC0r35mfOVUExHsBP5=URKFAt_wDTZ51pTc=XkXyogqKQ@mail.gmail.com>
2021-12-23  6:07   ` Daniel Vicarel
2021-12-23 18:35     ` 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=CALRdAffjmvHao8TRfB9YJez1acwHDAq2ZqiqaCRRr5MaWzhxig@mail.gmail.com \
    --to=shundra8820@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 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 NNTP newsgroup(s).