Continuous Integration (2024 Update)
martinfowler.com
martinfowler.com
With everyone pushing their changes to main (even if tested...) before getting main to a releasable state there's the open items of reviews (every commit/push), fixes, re-review, ... That might work with developers writing flawless code or relaxed reviews, but for me it was painful in reality.
CI shifts the problem from having to solve merge issues before release to having to solve review issues before release. Releasing is impossible if merges fail, but reviews can be skipped. CI seems to promote reduced review quality.
A perfect solution would avoid all problems close to the release.
In addition to small/fast feature branches an automated temporary what-if branch with frequent merges can provide a preview to detect and solve issues early, while avoiding troubles in main. It seems to help with the main issue CI solves (avoiding conflicts detected late), without causing degraded review quality.
As an added bonus you can have multiple release branches for 1.0 and 2.0 at the same time, or even forked release branches where 1.1 is forked from 1.0 if necessary.
You mentioned very short lived feature branches. What does that mean in your case? A few days or weeks?
If you go off on your own and then try to integrate after more than a month of development, then yeah, of course you are going to have diverging work that results in integration problems. That’s why continuous integration explicitly says you should be integrating at least daily. Otherwise it’s not continuous.
Of course, you might cause other people problems by dumping more than a month of work in your master branch all at once. That’s why things are easier with short-lived branches. But if you want to avoid integration problems yourself, integrate continuously.
A major revision of Continuous Integration
At the turn of the century, I was lucky to involved in several projects that developed the practice of Continuous Integration. I wrote up our lessons from this work in article on my website, where it continues to be a oft-referenced resource for this important practice. Late last year a colleague contacted me to say that the article, now nearly twenty years old, was still useful, but was showing its age. He sent me some suggested revisions, and I used this as a trigger to do a thorough revision of the article, considering every section in the original, and adding new ones to deal with issues that have appeared in the last two decades.
During those decades Feature Branching has been widely adopted in the industry. Many colleagues of mine feel that Continuous Integration is a better fit for many teams, I hope this article will help readers assess if this is the case, and if so, how to implement Continuous Integration effectively.