Every merge turns into a fight: which Git branching strategy fits your team?
A branching strategy is nothing more than your answer to three questions: when does a new branch get created, how long does it live, and where does it merge back. For most teams the right answer is short-lived branches and one long-lived trunk. GitFlow's develop, release and hotfix layers were designed for software that has to support several versions running in the field at the same time. What decides this for you is not the names of the branches but their age. Sort the open branches in your repository by last commit date. If some of them are older than two weeks, the question is not which model you picked, it is how large your batches of work are.
A long-lived branch bills you twice. The first charge is the conflict you can see: the further the branch drifts from trunk, the bigger the merge, and the more conflict markers land on screen, the more bad judgement calls get made. The second charge is the conflict you cannot see, and that one is the dangerous one. Two branches touch different files, Git merges them cleanly, but one of them changed a function's contract while the other started calling that function from a new place. The compiler says nothing. The tests say nothing either, because they never ran against that combination. Put the two together and you get a merge week, a code freeze, and a stabilization period nobody wants to own.
What the research actually says
DORA's trunk-based development page sets three concrete targets: three or fewer active branches in the application's repository, every branch merging into trunk at least once a day, and no code freeze periods where nobody can submit code. The same page notes that on teams working this way, branches typically last no more than a few hours. These targets come out of analysis of DORA data from 2016 and 2017: teams following the three practices scored better on both delivery speed and stability.
There is one more recommendation on that page, and it is where most teams get stuck: a build and test cycle measured in a few minutes. You cannot impose a daily merge rule on a project whose pipeline takes forty minutes, because nobody will follow it. Speed up your delivery pipeline before you change the branching model.
What GitFlow's author wrote ten years later
Vincent Driessen published GitFlow in 2010 and the model caught on harder than he expected. On March 5, 2020 he added a note to the top of the original post, saying the model had become a standard over those ten years, and in some teams a dogma. But web apps are delivered continuously, they are not rolled back, and you do not support several of their versions in the wild at once. In his own words, that was not the class of software he had in mind in 2010. For teams doing continuous delivery he suggests a much simpler workflow such as GitHub flow, and he closes with a line worth keeping: panaceas do not exist, consider your own context.
There are still places where the model earns its keep. Desktop applications, embedded software, libraries, and enterprise products where one customer runs 2.4 while another runs 3.1. There, release and hotfix branches answer a real need, because you have to ship a customer the fix without shipping them the new features. In a SaaS product that serves a single version over the web, those same layers produce nothing but waiting time.
If you deploy continuously: GitHub flow
The workflow in GitHub's own docs is six steps: create a branch, commit and push your changes, open a pull request, address the review comments, merge once approved, delete the branch. There is exactly one long-lived branch and it is the trunk. There is no develop, because the trunk is kept releasable at all times.
The gap in this workflow is that it never addresses releases. If you cannot ship the moment you merge, say because you have a mobile app waiting on store review, GitHub flow gives you half an answer. Store review means a queue of several days, and work keeps piling up on top of the version sitting in that queue.
The model in between: release flow
Microsoft's Azure DevOps team described the model that fills this gap in 2018. Day to day the work stays trunk-based: everyone works on short-lived branches and merges into trunk. The difference is that trunk does not go straight to production. At the end of each sprint a release branch is cut from trunk and the release ships from there. When a production bug appears, the fix lands on trunk first and is then cherry-picked into the release branch. As Microsoft's own documentation puts it, release branches never merge back into trunk, so the changes that matter get carried across one at a time.
Getting that order backwards is the common failure. Write the fix into the release branch first and you will reintroduce the same bug in the next version, which is a story plenty of teams can tell you from experience. Trunk is always the single source of truth; the release branch is a frozen copy cut from it.
How short is "short-lived"
The measure is stated plainly on trunkbaseddevelopment.com: a branch should last a couple of days at most, and past that it is turning into a long-lived feature branch. One developer works on it, or two if they are pairing. And the clause everyone skips: time spent waiting for review counts towards the branch's life.
That last sentence explains why branching strategy stays theoretical in so many teams. Where a pull request sits in the queue for two days, trunk-based development is impossible no matter what the model says. Fix review first: set a target waiting time for a pull request, assign a specific reviewer so that "someone will look at it" stops being the plan, and make splitting a large pull request in two a habit. With AI-generated code the pressure got worse, because output speed grew independently of review speed.
How unfinished work sits on trunk
The objection to merging daily is always the same: the feature is not done, how am I supposed to put it on trunk? The answer is to separate shipping the code from turning the feature on.
- Feature flags. The code goes to production but stays off, and switching it on is a separate decision. This is the same mechanism you need for progressive rollout anyway. Clean the flag up once it is on, or flags become your next pile of technical debt.
- Branch by abstraction. Put the old and new implementations behind the same interface, move the callers across one by one, delete the old one last. This is how you run a large rewrite without a branch that stays open for months.
- Expand and contract. For a schema change, add the new column and write to both places first, move the reads, drop the old column last. The same logic applies to API versioning.
The two mechanisms that keep trunk green
In a repository where everyone merges daily, a broken trunk stops the whole team rather than one person. The first protection is required checks: merging stays blocked until tests and the build pass. Before you put that gate in place, your test automation has to be trustworthy, otherwise the team simply learns to override red checks.
The second is a merge queue. The classic scenario: two pull requests are each green on their own but not in combination, and trunk turns red once both are in. A queue lines the pull requests up and tests each one as it would look merged with everything ahead of it, admitting it only then. GitHub made this generally available in 2023. Two details bite during setup: if your workflows do not add the merge_group trigger alongside pull_request, the queue waits forever for a required check to report, and if you use a third-party CI provider it has to run on branches prefixed with gh-readonly-queue/. A pull request that fails a check or conflicts with the base gets dropped from the queue.
Two Git settings that make conflicts cheaper
Shortening branch lifetime reduces conflicts without eliminating them. Two settings make what is left cheaper to resolve, and both sit switched off in most repositories.
By default merge.conflictStyle shows you only the two sides, so you see where each one landed but not what changed. diff3 adds the common ancestor. zdiff3, introduced in Git 2.35 in January 2022, goes one step further and moves the lines that are common at the start and end of a conflict outside the markers, which shrinks the region you have to resolve by hand. Running git config --global merge.conflictStyle zdiff3 takes a second.
The second is rerere. Git records how you resolved a conflict and replays that resolution when it meets the same one again. On a long migration that is the difference between resolving the same file by hand for the fifth time and not resolving it at all: git config --global rerere.enabled true.
The quiet security cost
Long-lived branches carry one more cost that rarely comes up. When you patch a vulnerable dependency on trunk, that patch only reaches the branches that have been open for three weeks once those branches merge. And when they do merge it produces conflicts, because the version gap has grown in the meantime. So the team postpones the patch. You are not choosing between delivery speed and security here. Both want the same thing: small, frequent merges.
Where to start
Measure before you change the model, because what needs fixing usually turns out not to be the model. Four numbers are enough: how many active branches are open right now, the median and worst-decile age of those branches, the time from opening a pull request to merging it, and how many hours trunk spent red over the last month. Those four are also leading indicators for your DORA metrics.
Then work through it in order. Cut review waiting time first, because everything else depends on it. Get build and test down to a few minutes. Put feature flag infrastructure in place so merging unfinished work stops being frightening. Turn on required checks, and add a merge queue if you need one. Leave branch names for last. If you want one thing to do this week, sort your open branches by age and plan to close the oldest three before Friday. The answer to the model question is probably hiding in why those three stayed open.
Need help with this topic?