- Get the latest from GitHub
git fetch origin - Switch to your branch
git switch fix-login-button - Replay it on top of main
git rebase origin/mainIf there's a conflict, fix the file, run git add on it, then git rebase --continue.
- Update your branch on GitHub
git push --force-with-leaseRebasing rewrites history, so a normal push is refused. Only do this on a branch nobody else is using.
Check it worked
- See the straight history
git log --oneline --graph -10
Undo it
- Stop a rebase halfway
git rebase --abortPuts your branch back exactly as it was before you started.
- Get the latest from GitHub
git fetch origin - Switch to your branch
git switch fix-login-button - Replay it on top of main
git rebase origin/mainIf there's a conflict, fix the file, run git add on it, then git rebase --continue.
- Update your branch on GitHub
git push --force-with-leaseRebasing rewrites history, so a normal push is refused. Only do this on a branch nobody else is using.
Check it worked
- See the straight history
git log --oneline --graph -10
Undo it
- Stop a rebase halfway
git rebase --abortPuts your branch back exactly as it was before you started.
- Get the latest from GitHub
git fetch origin - Switch to your branch
git switch fix-login-button - Replay it on top of main
git rebase origin/mainIf there's a conflict, fix the file, run git add on it, then git rebase --continue.
- Update your branch on GitHub
git push --force-with-leaseRebasing rewrites history, so a normal push is refused. Only do this on a branch nobody else is using.
Check it worked
- See the straight history
git log --oneline --graph -10
Undo it
- Stop a rebase halfway
git rebase --abortPuts your branch back exactly as it was before you started.

New to Rebase? I explain it in plain English on Layman Terms.