This guide outlines the technical trade-offs between "Squash and Merge" and standard "Merge Commits." While squashing offers a simple aesthetic, it introduces significant friction for complex engineering and historical recovery.
When you Squash and Merge, Git replaces all original commits with one brand-new commit hash on main. This "orphans" any follow-up branches.
- Identify the Boundary: You must manually find the exact commit hash where Phase 2 diverged from Phase 1.
- Run Rebase --onto:
git rebase --onto main phase-2-branch