mhagger / git-imerge

Incremental merge for git
GNU General Public License v2.0
2.68k stars 126 forks source link

Skip incompatible merges #171

Open NZJenkins opened 3 years ago

NZJenkins commented 3 years ago

Suppose I have two commits that don't merge easily Is it possible to skip the difficult merge and continue merging elsewhere?

The complete merge might look like the diagram below

   A  B  C
X  .  .  ?
Y  #  *  ?
Z  ?  .  .

* = merge done manually
. = merge done automatically
# = conflict that is currently blocking progress
? = no merge recorded

Merging branch with commits A, B, C and branch with commits X, Y, Z

mhagger commented 3 years ago

That wouldn't be in the spirit of the incremental merge, so it would complicate the idea quite a bit:

There are cases when it would be more plausible to skip around. Say there are two blocking merges, like in the following diagram:

       0    5   9
       |    |   |
   0 - ********** - c
       **?..*.--+
       *.?.*.|#??
       *.?...|???
       *.?..-+???
   5 - *...|#????
       **?.|?????
       *.?.|?????
   8 - *---+?????
       |
     d

In this case, imerge might ask you to resolve merge 5-5, but you might not know how. Meanwhile, you might know how to resolve merge 7-2. There is no theoretical reason that you shouldn't be able to do those two merges in either order.

In fact, you could do it, too. But you'd have to set up the merge yourself, by checking out branch refs/heads/imerge/NAME, resetting it to refs/imerge/NAME/auto/7-1, then running git mergerefs/imerge/NAME/auto/6-2, stage your changes, and then rungit imerge recordorgit imerge continue`. It wouldn't be too hard to automate this setup step (though I don't have plans to work on it anytime soon).