Interview Prep/Git & GitHub/Branching and Merging Workflows

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 →

  1. Ask what we need from history: a linear log for bisect and changelogs, or visible feature boundaries.
  2. For most product teams, pick squash merge in GitHub: one commit per PR, linear main.
  3. If we need to see feature groupings, use --no-ff merge commits.
  4. 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.

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching and Merging Workflows