git merge --squash <branch> stages all the branch's changes as one big set in your index — but doesn't commit. You then commit it as one new commit on the target branch.
Result: the feature branch's individual commits never appear in mainline history. The reviewer sees a single commit on main.
Pros:
- Clean mainline log
- Easier revert (one commit)
- Hides WIP/fix-typo noise
Cons:
- Loses fine-grained authorship within the feature
- The original branch is now diverged — usually just delete it
GitHub PRs offer "Squash and merge" as a one-click form of this. Many teams enable it as the only merge strategy.