What rebase does
Rebase takes commits from one line of development and reapplies them on top of another base. The result can produce a linear-looking history without a merge commit for the rebased sequence.
Rebase versus merge
Merge preserves the original branch topology and records the integration. Rebase rewrites the rebased commits so they appear to have been created from a different parent. Neither is universally better; the appropriate choice depends on team workflow and whether history is shared.
Rebase before publishing
A common use is updating a private feature branch with the latest target branch before opening or updating a review. Once a branch is public and others depend on it, rewriting its history requires coordination.