Does it merge without conflicts, equivalent to a rebase without conflicts?

Is it correct to git merge

be successful without conflict if and only if the appropriate one git rebase

is successful without conflict?

+3


source to share


1 answer


No, and there is actually a trivial case where the merge works fine but rebase does not:

...--o--A   <-- mainline
      \
       B--C--!C   <-- branch

      



where C

is the commit that conflicts with A

, and !C

is its reversion. Merge branch

back to is mainline

equivalent in source tree effect to merge commit B

back to mainline, on reload copies as C

(which conflicts with A

) and then !C

(which, when resolved, also conflicts with A

).

Of course, you can recompose interactively and easily dismissed as C

, and !C

in this case, but in a more complex chain, you can see how the commit may conflict with A

, but subsequent fixation can effectively resolve the conflict "in advance" so that merging tip branches back to the trunk have no conflicts.

+4


source







All Articles