[go: up one dir, main page]

|
|
Log in / Subscribe / Register

Avoiding the merge trap

Avoiding the merge trap

Posted Apr 22, 2023 14:24 UTC (Sat) by kleptog (subscriber, #1183)
In reply to: Avoiding the merge trap by marcH
Parent article: Avoiding the merge trap

> One of the reasons for NOT rebasing is "logical" conflicts that git does not see, typical example: some API change. No git conflict but compilation fails.

> In that case merging is superior because in case of a logical conflict then only the merge commit is broken, all the commits leading to it are still functional on both branches. When rebasing instead then ALL the rebased commits are broken by such a logical conflict. Forensics are also made more difficult.

The conflict is there, so needs to be resolved somewhere. The downside of doing it in the merge commit is that it's probably being done by someone other than the author. By asking the authors to rebase you push the work to the people who are most qualified to do it.

> One way to mitigate this is to actually TEST the rebased commits in CI:

Well of course you should test the individual commits again after rebasing, anything else is silly.


to post comments

Avoiding the merge trap

Posted Apr 22, 2023 15:17 UTC (Sat) by marcH (subscriber, #57642) [Link]

OK, I shouldn't have taken the example of a compilation failure. It was too simplistic.

If there's a compilation failure then there is a very good chance the maintainer will see it BEFORE either git pull or git pull --rebase and the project policy does not really matter because neither merge policy will happen.

> By asking the authors to rebase you push the work to the people who are most qualified to do it.

Yes but that was not the point I was trying to make.

My previous post was about when the maintainer _misses_ subtle logical conflicts and merges two branches that work separately but fail some run time test together. This is rare but it happens.

In that broken case then a merge gives a "less broken" and more accurate git history compared to git pull --rebase

(Merge train testing and similar prevent the merge no matter what the policy is)


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds