Git Branching – Is a ‘PRODUCTION’ Branch Necessary?

branchinggitgitflow

A short summary of how we do branch managing: From the MASTER branch one or many feature branches can be made (for mid to long term development), when deploy-able changes have been merged to MASTER then release branches are made. Release branches are kept for maintaining deployed version until the next release occurs and they are merged to PRODUCTION in order to build TAGS which are deployed to Live Environments.

First verse of the question: Is it actually necessary to have the PRODUCTION branch step? Surely TAGS can reliably be created off a Release Branch at the same point that it would have been merged to the PRODUCTION branch?

If they are worth having then the second verse of the question: Would it be a suitable source control to have more than one PRODUCTION branch while having just one MASTER?

The motivation: We will soon have an internal project starting that will (hopefully) be a "white-label" product we can use to replace three separate internal applications we use currently (as well as for any future applications). It would be one back-end, one library, one API but three teams using it and managing their own User Interfaces and adding reusable functionality to the back-end.

A thought was the project could be one repo with one MASTER, various feature branches for any of the teams as they need to develop things (mid- to long term). But should we then have a PRODUCTION branch for each of the three 'versions' of the product or just TAG off from the respective Release branches? So that they could deploy independently from each others' sprints and requirements (as long as they do not break the shared infrastructure).

PS:
Each of the three applications deploy to independent Live environments and used by different departments in the company.

PPS:
If you know of any other versioning-flows which would be better suited please tell me!

[EDIT – After reading jhr's answer]
Think of this as one BIG project/application. But instead of having one BIG team working on the sections used by 3 departments (each with their own required UI flows and features etc) we may be split into three teams, each working on a department's features, on the same code base (repo).
This is not a technical spec question per-say but rather one for opinion, experience or preference etc.

Best Answer

First of all, since your specifications are rather unclear, I'm not sure how much of this really applies. But I'll give it a shot...

If your project has one single release cycle, you only need one repository. If your three teams need to release new version independently, it gets a lot messier. But for that I'd need more specific input. At the moment, it sounds to me like you need to stabilize your API, develop the library and manage your back-end development. If that's part of one project, go ahead and use one repository.

As for the branching, I'd recommend to always have one branch that simply represents the latest released and working version. This branch will probably mostly have merge commits. I like the idea of release branches independent of development branches as a release manager could then easily review everything (after feature freeze if you want so), scratch the last few itches, set the version properly, and merge into your production branch. (You could even bind hooks or deployment strategies to that merge in order to automatically push release onto your build system or something).

As I said above, I'd recommend having one release cycle within one repository. If you can have that, only one production branch will be necessary. If the teams really need to release new versions of the same project independently, it feels like there's something wrong with the project management. But that's again without knowing much about the team and project in general.

A style that I like much is the git flow as described by Atlassian. It suggests having one master (production) and one development branch. On development the actual work happens but, that usually splits up into feature branches. What I like is that a development manager (someone with deep technical insight) can manage the development branch. They decide whether to merge new features or not. At some point they will tell a project/release manager that the team's done and that project/release manager can then (together with the development manager) work out the last few glitches on a release branch before it'll be merged into master (and back into development, of course). It's just an interesting separation of concerns that developers are so keen on regarding different aspects of the very same projects. :)

Hope this helps a bit.

Related Topic