Continuous Integration vs Feature Branches
After reading the Continuous Delivery Book, I have been thinking a lot about branching strategies and Continuous Integration versus Feature Branching. I put together this little chart of the pros and cons of each.
|Feature Branching||Continuous Integration|
|Trust||Does not require trust. You can control via GitLab who can merge into main branch. Great for open source projects and other low-trust environments.||Requires some trust since anyone can check into main.|
|Knowledge Distribution||Pull/Merge Requests (PRs) can serve as a built-in code review that helps to distribute knowledge.||By continuously integrating with others code you become more aware of what others are working on.|
|Merging||You avoid having frequent merges by creating branches and playing in your own sandbox. However when you do have to merge at the end of a feature, it can be quite painful, particularly if the feature branch is long-lived. Merges can be more difficult if someone other than the original author performs the merge.||You do end up merging a lot, but most of them are small and relatively painless.Also because you are doing it often, the code is often fresh in your mind, so that makes resolving conflicts easier.|
|Ease of Releasing New Features||Can be quite painful. Merging a long-lived feature branch into main can be quite difficult. Depending on how you set up PRs, they could become a bottlekneck (ie if only 1 person can approve merging into main).||Easy, since you have been integrating them all along. To avoid the user encountering half-finished features, you can use the Keystone Pattern.|
|Refactoring||Discourages refactoring outside your immediate feature, because it may take a while to merge those changes back in, increasing the chance of a conflict. Even if your merge is successful, others also have long-lived branches as well, so there is more potential for conflicts when they merge their changes in.||Encourages refactoring, because you simply merge your refactorings back into the mainline immediately. Everyone is in the habit of pulling frequently, so the chances of conflicts are less.|