git-rebase - Apply all commits from one branch to another.
Common use case: syncing an outdated branch with main.
Let’s say you are on branch outdated
, and you want to apply all newer commits from main
on top of outdated
branch, so you can continue working on outdated
branch and lately on merge with main
with ease.
First, switch to the outdated
branch.
Then, run:
git rebase origin/main
git add .
git commit -m "rebase"
git push origin/outdated