An interesting discussion that I had with my team mates over the last few days, whether we should create branches then merge later or keep working on the trunk within our Git based version control process. As the team is small, we are in the same premises but different locations, we agreed to move to work exclusively on the mainline for the following reasons:
- Reduce the amount of work having to remember which branches are active, so branches are an exception rather than the rule
- Adding practices like a CI pipeline (that’s additional work for all of us to setup) will provide a needed stability in the long-run as some of the projects are expected to be long running
- Working on the main line forces us to talk to each other, rather than IM away, so design decisions are shared across the team
- Branches discourage refactoring mostly due to the pain of merging refactored changes, and the fact that not everyone can benefit from the refactoring as soon as its completed – thanks to Twitter – Chris Ford
We used the following resources as research:
1. Martin Fowler – Feature Branch – http://martinfowler.com/bliki/FeatureBranch.html also talking about Feature Toggles – http://martinfowler.com/bliki/FeatureToggle.html
2. Apologists Defense of Trunk based development – http://www.tuesdaydeveloper.com/2015/05/an-apologists-defense-of-trunk-based-development/
3. What is Trunk Based Development http://paulhammant.com/2013/04/05/what-is-trunk-based-development/
4. Shades of Trunk based development – http://paulhammant.com/2014/09/29/shades-of-trunk-based-development/
What do you use with your team and why?
One word – GitFlow
🙂
+1 on GitFlow.
I do like feature branches to keep apart multiple streams of work. I can’t always focus at one time on a single set of changes, and need to switch between change sets. Feature branches help with this.
What I abhor is long-lived development branches.
For release branches it is different. Depending on your environment, you may need to support multiple release versions and fixing that is outside your control.