Git · English usage comparison
Merge vs Rebase: English Usage Guide for IT Professionals
Both integrate changes from one branch into another, but they do it differently. Merge preserves history with a merge commit; rebase replays your commits on top of the target, creating a linear history. The same code, two very different histories.
Side-by-side comparison
| Aspect | Merge | Rebase |
|---|---|---|
| History | Branched — preserves parallel work | Linear — as if you worked on top of main |
| Creates | A new merge commit with two parents | Replayed commits with new SHAs |
| Safe on shared branches | Yes | No — rewrites history |
| Conflict resolution | Once | Per replayed commit |
Example sentences
Merge
- "I merged the feature branch into main — the history shows both branches coming together."
- "Use git merge --no-ff to keep the feature branch visible in the graph."
Rebase
- "Rebase your branch onto main before opening the PR so the history is clean."
- "After rebasing, you'll need to force-push with --force-with-lease."
Exercises: choose the correct English usage
Select the best answer for each question, then check your reasoning.
1. Which git command creates a merge commit?
Explanation: "git merge feature" creates a new merge commit joining the two branches.
2. Which command gives you a linear history without merge commits?
Explanation: "git rebase" replays commits in a line, producing no merge commits.
3. A colleague says "don't rebase this branch — others have pulled from it." Why?
Explanation: Rebase rewrites commit history. Anyone who pulled the original commits will have divergent history.
4. After rebasing, why must you force-push?
Explanation: Rebase rewrites commits (new SHAs), so the remote refuses a normal push — you must force-push.
5. "Squash and merge" on a pull request is closest to ___.
Explanation: "Squash and merge" collapses all branch commits into one commit on main — a common pattern for clean main history.
Frequently asked questions
What is the golden rule of rebasing?
Never rebase commits that have been pushed to a shared branch. Rebase only your private, unpushed work.
What is "interactive rebase"?
"git rebase -i" lets you edit, reorder, squash, or drop individual commits. Used to clean up history before opening a PR.
What does --force-with-lease do?
A safer version of --force-push. It checks that no one else has pushed to the branch since you last fetched — if they have, the push is rejected.
What is a "merge conflict"?
When two branches change the same line of code differently, Git cannot auto-merge and asks you to choose. You resolve it by editing the file and staging the resolution.
What is "fast-forward merge"?
When the target branch hasn't diverged, Git simply moves the pointer forward. No merge commit is created. Use --no-ff to force a merge commit anyway.
What does "origin/main" mean?
The remote-tracking reference for the main branch on the "origin" remote. "git rebase origin/main" replays your commits on top of the latest remote main.
What is "git reflog"?
A log of everywhere HEAD has pointed. Useful for recovering from a bad rebase — find the pre-rebase SHA and reset to it.
What is "cherry-pick"?
"git cherry-pick <sha>" applies a single commit from another branch onto your current branch. Useful for backporting a fix without merging the whole branch.
Merge or rebase — which should I default to?
Default to merge for shared branches; rebase only your private feature branch before a PR. When in doubt, merge is safer.
What does "behind X commits" mean?
"Your branch is 15 commits behind main" means main has moved forward 15 commits since you branched off. You need to merge or rebase to integrate those changes.