What you need to know

Merge preserves the branch relationship and creates a merge commit when needed. Rebase replays commits on a new base to create a straighter history, but it rewrites commit IDs.

How to apply it

Follow the convention used by your team, rebase only commits that have not been shared when required, and inspect the graph before merging. Use a merge when preserving the collaboration context is valuable.

Common mistake to avoid

Do not rebase public commits without coordinating. Other developers may already have based work on the original history.