- Do you want to keep your branch history clean and effective?
- Are you part of a development team of at least 4-5 people, looking for a structured but agile workflow?
π Reading time: 3 minutes
In my team we adopt a variant of Git Flow, with influences from Trunk-Based Development (TBD), optimised for Agile methodologies. This approach combines organisation and flexibility, improving the development and integration process. In this post I'll explain our strategy.
π A Git repository structured on four levels
master: holds the stable code, production-readydevelop: collects the candidate versions for the staging environment at the end of the sprintsprint: a temporary branch used during a single release cycle in the testing phasefeature/fix: branches dedicated to single features or fixes, integrated into thesprintbranch via squash merges
π Merge strategy
- merge from parent to child (
masterβdevelop,developβsprint,sprintβfeature) - squash merge from child to parent, so as to keep a cleaner history
- the
feature/fixbranches are forked off the currentsprintbranch. Before running the squash merge towardssprint, it's a good idea to "pull in" the most recent changes from thesprintbranch into your feature, resolving any conflicts ahead of time - at the end of the sprint, its branch (
S) is merged intodevelopvia a squash merge. The sprint branch is then archived and a new branch (S+1) is forked offdevelopfor the next sprint. Thefeature/fixbranches linked to the completed sprint are deleted, thus preserving the necessary granularity while discarding superfluous details
π Advantages of this hybrid flow
- parent-to-child merges ensure branches always inherit the latest updates
- constant alignment avoids large conflicts at the end of development
- any conflicts are resolved in the child branches, keeping the parent branch clean
- thanks to the squash merge towards the parent branch, the main history isn't weighed down by intermediate commits
- you keep a clearer, more linear log, useful for debugging and rollbacks when needed
- the team can work in parallel on independent features
- alignment with continuous integration (CI/CD)
- suitable both for teams doing frequent releases (TBD) and for those working on more structured sprints
π Conclusion
This hybrid model between Git Flow and TBD turns out to be particularly effective in an iterative, sprint-based development context: it provides structured control over releases and, at the same time, a leaner management of features and merge strategy, in line with the principles of continuous integration.
π© Get in touch if you'd like a more detailed guide!
See you at the next pill! β
![Release history on master with squash merges: linear history and [RELEASE vX.Y.Z] tags](/images/articles/0011-git-history.jpeg)