Courses / GitHub
19. Merging pull requests (squash, merge, rebase)
Merging PRs via squash, merge, or rebase strategies in GitHub and when to choose each option.
Git / GitHub / Bash
Merging pull requests (squash, merge, rebase)
Ways GitHub combines a pull request's commits into the target branch with different history and commit shapes.
"I want a clear, reliable history — but sometimes I also want to preserve each tiny commit."
GitHub offers three merge strategies: "Create a merge commit" keeps all commits and adds a merge commit; "Squash and merge" collapses all PR commits into one commit; "Rebase and merge" replays PR commits onto the target branch without a merge commit.
"I want a clear, reliable history — but sometimes I also want to preserve each tiny commit."
GitHub offers three merge strategies: "Create a merge commit" keeps all commits and adds a merge commit; "Squash and merge" collapses all PR commits into one commit; "Rebase and merge" replays PR commits onto the target branch without a merge commit.