A feature branch has twenty small commits, several of them fixups. The team wants the target branch to receive a single clean change when the pull request completes. Which option achieves this?
Show answer and explanation
Answer: B
Squash merge collapses the branch's commits into one commit on the target when the pull request completes. Interactive rebase lets the author reorder, fix up, or squash commits on the branch before publishing. Both produce a tidy history. A no-fast-forward merge keeps every commit and adds a merge commit, while recreating branches or pull requests discards review context.
Why the other options are wrong
- A. A non-fast-forward merge records a merge commit but keeps all twenty branch commits in history, so the target does not receive a single clean change.
- C. Deleting and recreating the branch removes its history and linked review threads. It does not consolidate the commits into one change.
- D. A new pull request starts with the same messy commits. Closing and reopening does not change how the branch's history is structured.