Re: Why does "merge --continue" expect no arguments?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Vicarel <shundra8820@xxxxxxxxx> 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.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux