git-imerge
git-imerge copied to clipboard
Skip incompatible merges
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
- User skips A, Y
- B, Y is manually merged via B, X
- And merging continues
That wouldn't be in the spirit of the incremental merge, so it would complicate the idea quite a bit:
-
In your example, you wouldn't have merge
A-Y, so what would be the parents ofB-Y? I suppose you could mergeBandYdirectly, but then what? Would you come back toA-Ylater, or hope to avoid it altogether? -
Normally, if
A-Yis difficult to resolve, then mergingBandYdirectly to produceB-Ywill be, too (though this might not be the case if, say, commitBreverts part or all of commitA). -
What if, later,
A-Zturns out to conflict? If you've never doneA-Y, then what first parent would you use for theA-Zmerge? And again, ifA-Yis difficult to resolve, then going directly toA-Zprobably will be, too.
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 merge refs/imerge/NAME/auto/6-2, stage your changes, and then run git 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).