git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Daniel Vicarel <shundra8820@gmail.com>, git@vger.kernel.org
Subject: Re: Why does "merge --continue" expect no arguments?
Date: Mon, 27 Dec 2021 11:29:15 -0800	[thread overview]
Message-ID: <xmqqzgolx2wk.fsf@gitster.g> (raw)
In-Reply-To: <211227.868rw7exvi.gmgdl@evledraar.gmail.com> (=?utf-8?B?IsOG?= =?utf-8?B?dmFyIEFybmZqw7Zyw7A=?= Bjarmason"'s message of "Mon, 27 Dec 2021 00:31:07 +0100")

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

>>>     $ git merge --continue
>>>     fatal: There is no merge in progress (MERGE_HEAD missing).
>>>
>>> FWIW I prefer and use it for that reason, i.e. it's useful for scripting
>>> to use these "stateful" commands when we're in some sort of rebase/merge
>>> "sequence" since it's an extra layer of sanity checking.
>>
>> There is no additional safety afforded by that, though.  There is no
>> reason why one would even try to say "merge --continue" without
>> doing any merge to begin with.
>>
>> The "merge --continue" not taking any pathspec is a bit of safety,
>> but even there, "commit" already has its own safety to reject
>> pathspec when it notices that it is concluding a conflicted "merge",
>> so "merge --continue" is not necessary for additional safety there,
>> either.
>
> The reason would be that you're confused about what state you're in.
>
> I've had that a few times, so I prefer it over "git commit", so I daresy
> someone less experienced in using git could and would benefit from it as
> well.

One can be lost and think that one is in the middle of "git merge"
when in reality there is no merge going on.  Or one can be lost and
confused the other way around, i.e. one thinks one is about to
finish the work one has been doing and conclude in a single parent
commit when in reality that one has done all that is necessary to
whip the working tree and the index into a state good enough to
record as a commit object.

In the former case, saying "git merge --continue", instead of "git
commit" may STOP oneself from proceeding, but then what?

Step back and think the other confusion first.  Saying "git commit",
instead of "git merge --continue", would allow one to record the
merge commit.  It opens an editor, its first line of the log message
would say "Merge blah into bar", the comment section tells you that
you are committing a merge.  It even prevents one from making a
partial commit with "git commit <pathspec>" or screw up the state
with "git commit --amend".  It is totally safe.

Now back to the former case.  You thought your working tree contents
and the index was good enough shape to say "git merge --continue",
but the command refuses because you were not merging.  I have a
suspicion that the message I am responding is a straw-man not worth
I should spend more time on, and if you are truly lost you would
either (1) look at the command line prompt or (2) run "git status"
to re-orient yourself before doing anything drastic like running the
"git merge --continue" command, but hypothetically, if you are lost
between merge and commit yet you are confident enough that your
working tree state and the index is worth recording in a commit
anyway, after a mistaken "git merge --continue" stops you from doing
so, I expect that you would "git commit" to record that tree into a
commit anyway, no?

So, I do agree there would be cases where a user is lost and does
not know what state the working tree s/he just came back to is in,
but "git merge --continue" is a mechanism that gives great help to
such a user.  "git status" may well be such a command, but "git
merge --continue" is not, and training users to use the latter
certainly is a wrong direction to go in.

By the way, you are wasting your time by repeating what you already
said and given an answer that the line of reasoning does not make
much sense.  Unless your goal is to be the one that sends the last
message to a discussion thread, that is.  You can respond to this
message without anything new and I promise that I won't repeat what
has been said already, in such a case.  So you'll be the last one to
utter in this thread then ;-)

You can share a new perspective, of course, in which case I may say
"Light! thanks".





  reply	other threads:[~2021-12-27 19:29 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
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 [this message]
     [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=xmqqzgolx2wk.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=shundra8820@gmail.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).