Atlas › 17 Git & Version Control › Rebase vs Merge☰ Read as one page
Rebase vs Merge
2.1Two Ways to Integrate ChangesBoth merge and rebase integrate changes from one branch into another, but they produce different commit history. Understanding the…2.2MergeA merge creates a new "merge commit" that combines the histories of two branches. The full branch history is preserved in the graph.2.3RebaseA rebase replays your commits on top of the target branch, creating a linear history as if you had written your code after the latest…2.4When to Use EachThe golden rule: Never rebase commits that have been pushed to a shared branch and that others may have based work on. Rewriting shared…2.5Resolving Conflicts During RebaseWhen rebasing, Git replays each commit one by one. If a commit conflicts with the target branch, Git pauses and asks you to resolve it.2.6Interactive Rebase: Cleaning Up Before a PRInteractive rebase lets you rewrite, combine, reorder, or drop commits before sharing them.2.7Squash MergeMany teams use squash merge when completing PRs. A squash merge combines all PR commits into a single commit on main.2.8Practical Workflow for QA EngineersHere is the daily workflow that keeps your branches clean:2.9Hands-On Exercise1. Create a feature branch, make 5 commits (including some "WIP" and "fix typo" commits) 2. Rebase the branch onto the latest main 3. Use…