Rebasing
Rebase moves or replays commits onto a new base. It can create a cleaner, linear-looking history, but it rewrites commit identities because the replayed commits are new commits.
A common workflow is rebasing a feature branch onto the latest main before opening a pull request.
Do not casually rebase commits that other developers have already based work on. Shared history rewriting can force collaborators to reconcile divergent commit identities.
git switch feature/login
git fetch origin
git rebase origin/mainGit temporarily removes the feature commits, updates the base to origin/main, and replays those feature commits on top of it.
Rebase creates new commit identities for replayed commits.
Rebase can produce a linear history.
Avoid rewriting public history unless the team explicitly agrees.
Why does rebasing change commit hashes?