How do you safely merge a 50-commit stale branch with conflicts?
Your discipline for resolving long-lived branch drift without breaking team CI.
Assess relevance, merge main locally, validate via draft PR and tests, merge off-peak with rollback ready.
WHAT THIS TESTS: This question evaluates whether you treat version control as a team coordination tool rather than a personal convenience. A fifty-commit gap signals a process failure, and the interviewer wants to see if you prioritize pipeline stability and teammate disruption over simply getting the code in. They are looking for awareness of blast radius, rollback readiness, and prevention.
A GOOD ANSWER COVERS: First, assess whether the branch is still needed because business requirements may have changed during the drift. Second, choose a safe integration strategy: merge main into the feature branch locally to preserve commit hashes and shared history, avoiding rebase if anyone else might have pulled the branch. Third, resolve conflicts incrementally and run the full test suite locally before pushing anything. Fourth, use a draft pull request to exercise the real CI pipeline without spamming reviewers or triggering merge queues prematurely. Fifth, time the actual merge during low traffic and ensure a fast rollback path via revert or feature flags. Sixth, address the root cause by advocating shorter branch lifetimes, smaller changes, or trunk-based development.
COMMON WRONG ANSWERS: Rebasing a long-lived public branch is a major red flag because it rewrites history and breaks every collaborator's local environment. Another red flag is resolving conflicts without running tests and then pushing straight to main, which treats CI as a personal debugging service. Saying you would just open a normal pull request and let the team review a known conflicted state wastes time and signals poor judgment. Similarly, suggesting force-push to overwrite remote history shows a disregard for shared repositories.
LIKELY FOLLOW-UPS: The interviewer may ask how your strategy changes if the branch contains a critical security patch that cannot be discarded. They might probe whether you would use a temporary integration branch or a merge queue in a monorepo with high velocity. You could also be asked how feature flags would have eliminated the need for this long-lived branch, or how you would handle the situation if the original author is on vacation and no one understands the conflicts.
ONE CONCRETE EXAMPLE: Imagine the branch touches a shared API contract that was refactored in main. You would fetch latest main, merge it into the feature branch, resolve the contract conflicts and update consumer tests locally, then run the service test suite. You would push the merge commit to a remote integration branch, open a draft pull request to trigger the full CI matrix including integration tests, and only convert it to a real PR after a green build. You would merge during a quiet window, monitor error rates for thirty minutes, and keep a revert command ready. Afterward, you would propose a team policy to archive branches older than three days.
Read the original → community.atlassian.com
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.