Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of an "integration branch"?

Tags:

git

git-branch

If a branching strategy consists of n feature branches, a "master" (mainline) and an "integration" branch. What is the purpose of the integration branch? Why can testing and integration not be performed on the feature branch itself?

like image 610
Ben Aston Avatar asked Dec 13 '10 12:12

Ben Aston


3 Answers

Because it's a feature branch. It should only contain changes pertaining to the one feature. The integration branch is where you bring multiple features together for testing, before the final push onto master.

Of course, you don't have to separate things this way. You could do integration on feature branches, just as you could do all your work on master. But separation of concerns is a good thing.

like image 182
Marcelo Cantos Avatar answered Sep 20 '22 15:09

Marcelo Cantos


To be a bit more specific on why exactly "separation is good": The purpose of the integration branch is to determine whether new features work not only on their own, but also in combination with other new features. This means that they might not, the features might cause conflicts that take a while to resolve.

However, you still might want to start deploying a subset of the new features to the mainline branch, so you don't block all features because an incompatibility between two of them.

Now, if you had already merged feature branches into one another, you will have a hard time merging them separately into the mainline. It's not entirely impossible, but it's certainly a hassle (I have tried).

If your feature branches contain major code churns, or if they overlap significantly with regard to the areas of code that is being worked on, you may even want to take this idea further, and have branches that integrate two features before merging them anywhere else, including the global integration branch, i. e. have multiple levels of integration. Of course, this is generally not a desirable situation, but you may not be able to avoid it, and the resulting conflicts can be a lot easier to resolve if you are generous with integration branches.

like image 24
Hanno Fietz Avatar answered Sep 21 '22 15:09

Hanno Fietz


One major reason i often see for the need for an "integration" branch is when your feature branches are untestable on their own. In my experience, this usually is due to a database dependency. Or, consider a website project that is database backed... lets say its a JSP application hosted in BEA Weblogic, back by a 60GB Oracle database; It would take a LOT of hardware to give each feature branch its own BEA Weblogic and Oracle instance to test from. Instead, it is generally easier to develop as best as possible into a feature branch, but move into an integration branch for full QA testing, where QA needs to be performed on a full web server and database.

like image 25
CodingWithSpike Avatar answered Sep 18 '22 15:09

CodingWithSpike