Fundamentals · Medium · Free
Git merge vs rebase — when to use which?
FresherFundamentalsSoftware Engineering & Tools
Merge vs rebase
For Git merge vs rebase — when to use which, interviewers listen for a crisp definition, how the pieces interact in a real system, and one trade-off or failure mode you have seen or would guard against.
| Merge | Rebase | |
|---|---|---|
| History | Preserves branches | Linear |
| Use | Shared main, PRs | Local cleanup before push |
| Risk | Merge commits | Don't rebase public shared branches |
Golden rule: never rebase commits others already pulled.