git rebase
git rebase <branch>
Risk: Careful
What it does
Replays your commits on top of another branch. You get new commits.
When to use it
To update your own branch before sharing it. Not on shared branches.
Example
$ git rebase mainPut my branch's commits on top of the latest main.
$ git rebase --continueGo on after you fixed a conflict and added it.
$ git rebase --abortCancel and go back to how it was.
$ git rebase -i mainTidy your commits: squash, reword, drop, reorder.
Learn it in: Rebase basics · Official docs