The team argues about fast-forward merges versus merge commits on `main`. How do you settle it?
BeginnerScenarioBranching and Merging Workflows
Answer
Situation read → This is a policy choice, not a technical right or wrong.
What I'd do →
- Ask what we need from history: a linear log for bisect and changelogs, or visible feature boundaries.
- For most product teams, pick squash merge in GitHub: one commit per PR, linear
main. - If we need to see feature groupings, use
--no-ffmerge commits. - Enforce the choice in repo settings (allow only the chosen merge button) instead of relying on convention.
git merge --ff-only feature # refuses if a merge commit would be needed
git merge --no-ff feature # always creates a merge commit
Why → A setting that cannot be bypassed ends the argument and keeps history consistent.
Interview tip → Mention that you disable the merge types you do not want in GitHub settings.
More on Branching and Merging Workflows
You run `git pull` and Git stops with a merge conflict in `app.py`. What do you do?BeginnerYour feature branch is three weeks old and `main` has moved a lot. Merge `main` in, or rebase onto it?IntermediateA teammate branched from the wrong base, and their PR shows 40 unrelated commits. How do you fix it?IntermediateBefore merging, you want to see exactly what the feature branch adds compared to `main`. Which commands?BeginnerHalfway through a merge you realise you pulled the wrong branch. How do you back out?BeginnerYou keep resolving the same conflicts again and again while rebasing a long-lived branch. How do you stop?Intermediate