Interview Prep/Git & GitHub/Branching strategies, pull requests and code review

How do you decide between merge, squash and rebase for PRs on a team?

IntermediateConceptBranching strategies, pull requests and code review
Answer

Squash gives a clean one-commit-per-PR main and easy reverts, but loses granular commits. Merge commits keep full history and suit release branches where you want to merge forward without conflicts. Rebase-and-merge gives linear history with each commit retained but needs atomic, well-written commits. Most teams choose squash for apps and merge commits for GitFlow release branches.

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching strategies, pull requests and code review