39. What is the difference between git merge and git rebase?
MediumTesting & engineering practice
Technical
Show model answer
Merge combines branches with a merge commit and preserves the exact history. Rebase replays your commits on top of another branch, producing a linear history but rewriting commit IDs.
Never rebase commits that others have already pulled; rebase local work to tidy it, merge shared branches.