Is merge without conflicts equivalent to rebase without conflicts?
- Git squash all commits in branch without conflicting
- How to properly rebase in SourceTree?
- What does it mean when git pull causes a conflict but git pull --rebase doesn't?
- How to run tests for all commits during a rebase
- Git Squash sequential commits by an author to compress history
- how to rebase these complicated merged commits with git
One Solution collect form web for “Is merge without conflicts equivalent to rebase without conflicts?”
No, and in fact there’s a trivial case where merge works fine but rebase doesn’t:
...--o--A <-- mainline \ B--C--!C <-- branch
C is a commit that conflicts with
!C is its reversion. Merging
branch back into
mainline is equivalent in source-tree effect to merging commit
B back into mainline, while rebasing copies both
C (which conflicts with
A) and then
!C (which when being resolved, also conflicts with
Of course, you can rebase interactively and simply drop both
!C in this case, but in more complex chains, you can see how a commit might conflict with
A but a subsequent commit might effectively resolve that conflict “in advance”, so that merging the tip of the branch back into the mainline has no conflicts.