Scrivio Interview library
LeadershipAdvanced6 min read · updated 12 November 2026

You need to support three released versions of an on-premises Java product while continuing development on main. Design the branching and backport process.

Keep main for the next release and one maintenance branch per supported version, such as release/4.x, release/5.x and release/6.x. Choose one rule for fixes and apply it always: either fix on main and cherry-pick down to each affected branch, or fix on the oldest affected branch and merge forward. Automate the backport pull requests and run the full test suite on every branch, and limit the number of supported versions with a published end-of-life policy, because each branch costs CI time and engineering attention.

Why this question is asked

On-premises products live differently from cloud services. Customers install a version and upgrade on their own schedule, sometimes years later, so a security fix may be needed in three releases at once. Without a clear process, fixes get applied to some branches and forgotten on others, and a customer on 4.x is still exposed months later. Interviewers ask this to see whether we can design a process that is consistent, automated and affordable. In this answer, we will lay out the branch structure, compare the two ways of moving fixes between branches, automate the backports, set up CI per branch, and look at why an end-of-life policy is part of the design.

1The Branch Structure

Main is where development of the next release happens, ideally trunk-based, with short-lived branches merged daily. When a version is released, we create a maintenance branch from the release tag, for example release/6.x from v6.0.0. From then on, that branch only receives fixes, never features, and each patch release, such as 6.0.1 or 6.0.2, is tagged on it.

With three supported versions in the field, we have main plus release/4.x, release/5.x and release/6.x. The rule that keeps this manageable is that a maintenance branch only receives changes that have a specific reason to be there: a bug fix, a security fix, or a dependency upgrade for a vulnerability.

2Choosing How Fixes Travel Between Branches

There are two consistent ways to get one fix into several branches, and the important thing is to choose one and apply it every time.

The first is upstream first, then cherry-pick down. The fix is made and reviewed on main, then cherry-picked, meaning the same change is re-applied as a new commit, onto each affected maintenance branch. The advantage is that main always has every fix, so a fix can never be lost in the next release. The cost is that older branches may differ, so a cherry-pick may conflict or need adapting.

The second is fix on the oldest affected branch and merge forward. The fix lands on release/4.x, then 4.x is merged into 5.x, 5.x into 6.x and 6.x into main. Some open-source projects, including the Spring projects, work this way. The advantage is that merges guarantee every newer branch contains the fix, and history shows it clearly. The cost is that every merge forward must be done in order, and changes that should not travel forward need care.

Text
# upstream first: fix on main, then cherry-pick down
git switch main && git merge --no-ff fix/xml-parser-xxe # fix merged on main as abc1234
git switch release/6.x && git cherry-pick -x abc1234 # -x adds "(cherry picked from commit abc1234)"
git switch release/5.x && git cherry-pick -x abc1234
git switch release/4.x && git cherry-pick -x abc1234 # conflict: adapt to the older code, test
# merge forward: fix on the oldest branch, then merge upwards
git switch release/4.x && git merge --no-ff fix/xml-parser-xxe
git switch release/5.x && git merge release/4.x
git switch release/6.x && git merge release/5.x
git switch main && git merge release/6.x
Step throughUpstream first: one fix, three backports
  1. Fix and review on mainPR labelled backport-6.x, backport-5.x, backport-4.x
  2. Bot opens backport PRsone cherry-pick per labelled branch
  3. Cherry-pick applies cleanly?
    YesFull CI on that branch, then mergeNoAuthor adapts the change, then CI
  4. Patch releases tagged6.0.3, 5.4.9, 4.8.12
  5. Record in the fix trackerwhich versions contain the fix

5 steps in order. Play them, or step through them one at a time.

Labels decide where a fix goes; automation does the repetitive part.

Notice the -x option on cherry-pick: it records the original commit in the message, so we can later see which fixes reached which branch. For a team with mostly cherry-picked backports and a busy main, upstream first is usually the simpler rule; for a team where fixes mostly start on old versions, merging forward is natural. Mixing the two leads to fixes that exist on 6.x but not on main.

3Automating the Backports

Doing cherry-picks by hand across three branches is slow and error-prone. Most teams automate it with a backport bot or a CI workflow: when a pull request merged into main carries a label such as backport-5.x, the bot cherry-picks the commits onto a new branch from release/5.x and opens a pull request. If the cherry-pick conflicts, the bot reports it and assigns the original author, who resolves it in that pull request. Each issue or ticket also records its affected versions, so a release manager can check before each patch release that every planned fix has landed.

4CI on Every Supported Branch

Each maintenance branch must run the full test suite on every change, not a reduced one, because a fix that is correct on main can be wrong on code that is two years older. This also means each branch keeps its own build environment: release/4.x may build with JDK 17 and an older Spring Boot, while main builds with JDK 25. The pipeline configuration lives in each branch, so it matches the code.

Branches that receive no changes for months still need occasional builds, for example a scheduled nightly or weekly run, so that a broken build environment, an expired certificate in a test or a dependency that vanished from a repository is found before an urgent security fix needs the branch.

5Limiting Supported Versions

Every supported version has a cost. It needs CI capacity, test environments, engineers who still understand that code, and time for every backport. With three versions, one security fix may become four pull requests and four patch releases. So the design must include an end-of-life policy, published to customers in advance, for example: each major version receives fixes for 24 months after release, and security fixes only for a further 12. When a version reaches end of life, its branch is frozen and its CI removed. A clear policy also gives customers a reason to upgrade, and it lets the team plan staffing.

Supported versions at one point in time
BranchStatusReceives
mainnext release (7.0)features and fixes
release/6.xcurrentbug and security fixes
release/5.xmaintenanceimportant bug and security fixes
release/4.xsecurity only, ends Junesecurity fixes
release/3.xend of lifenothing; branch frozen
A published policy tells customers what each line receives and when it ends.

6Follow-up questions

Should fixes ever go to a maintenance branch only?

Sometimes a bug only exists in an old version, because the code was rewritten on main. Then the fix goes only to the affected branches, and the ticket records that main is not affected. With merge forward, we merge it upwards but resolve the newer branches so the change is not applied where it does not belong.

How do we avoid features leaking into maintenance branches?

Make the rule explicit and visible: only labelled fixes are backported, the bot only acts on labels a maintainer applies, and branch protection on release branches requires review by the release owners.

What about dependency upgrades on old branches?

Security-driven upgrades must be backported, but often only to a patch version of the dependency that the old branch can use. When an old line depends on a library version that is itself out of support, that is a strong argument for ending support of that line.

7Conclusion

In this answer, we designed a branching process for three released versions: main for the next release and one maintenance branch per supported version, fixes moved by one consistent rule, either upstream first with cherry-picks or merge forward from the oldest branch, automated backport pull requests with full CI on every branch, and a published end-of-life policy that limits how many lines we pay for.

What to say in the interviewAbout 80 seconds aloud

Open with

I would keep main for the next release, developed trunk-based, and create one maintenance branch per supported version from its release tag, so release/4.x, 5.x and 6.x. Maintenance branches only take fixes, never features.

Then, if they want more

For moving fixes, I would pick one rule and stick to it. My default is upstream first: fix and review on main, then cherry-pick with minus x onto each affected branch, so main can never miss a fix.

The alternative, used by projects like Spring, is to fix on the oldest affected branch and merge forward, which also works, but mixing the two loses fixes. I would automate it: a label like backport-5.x on the pull request makes a bot open the cherry-pick pull request, and conflicts go back to the author.

Each branch runs the full test suite with its own JDK and dependencies, plus a scheduled build so a branch that has been quiet for months is known to work when a security fix arrives.

Finally, I would publish an end-of-life policy, say 24 months of fixes and then 12 of security fixes only, because every supported line costs CI, environments and people who know that code.

About this answer

Last updated
12 November 2026
Versions it names
Java 17, Java 25
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "You need to support three released versions of an on-premises Java product while...": https://scrivio-interview-library.netlify.app/java/version-control-and-ci/2f8da43d3c/