FahamLah

Commands

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 main

Put my branch's commits on top of the latest main.

$ git rebase --continue

Go on after you fixed a conflict and added it.

$ git rebase --abort

Cancel and go back to how it was.

$ git rebase -i main

Tidy your commits: squash, reword, drop, reorder.