Subject: Re: git bug - merging JS / Node.js code with "git merge --squash"

From: Junio C Hamano <[email-masked]>
Date: Thu, 15 Dec 2016 10:10:46 -0800

Alexander Mills <[email-masked]> writes:

> basically it is doing the merge with this line:
>
> git merge --squash -Xtheirs dev -m "squashing" &&

The order of command line parameters are "dashed options and their
arguments first, then refs (and then pathspecs if exists), so you
should make it a habit to move that "dev" at the end of the command
line.  This does not have anything to do with the issue you are
asking for help, though.

I suspect the problem is not in --squash but with -Xtheirs.  It is
"I give up correctly resolving conflicts and blindly take whatever
comes from their side, discarding what I did".

The "git merge" command stops and asks a human to help resolving a
conflict using their brain when it needs to because the command
knows it itself does not have any but the human user has a better
one ;-).  -Xtheirs and -Xours disables this safety/sanity.

If you punt, it is expected that you would get garbage.  

For example, your side may have introduced a new function (or
renamed an existing one) near where their side made a change that
resulted in conflicts.  Naturally, your side also would have added
new callsites to that new function (you wouldn't be adding an unused
function).  Imagine in such a scenario that you asked "discard what
I did in the conflicted section and blindly take whatever they did".
What happens?  They may not have done anything near the places you
added calls to the new function and these sections of the code would
merge cleanly with or without -Xtheirs, but the actual new function
you added may be in the conflicted section that you asked to discard,
taking their changes.