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.
More on Branching strategies, pull requests and code review
What is a feature-branch workflow?BeginnerWhat is GitFlow and what are its branches?IntermediateWhat is trunk-based development and what does it require?IntermediateWhat is GitHub Flow and how does it differ from GitFlow?BeginnerWhat is release-branch strategy with cherry-picked fixes?IntermediateWhat makes a good pull request?Beginner