git rebase

ref – https://www.atlassian.com/git/tutorials/merging-vs-rebasing

say you’re on your main branch. and you do a git pull for the latest.

However, you’ve been working your feature branch.
By using rebase, you can cut your branch from its root, and snap it onto main’s HEAD:

git checkout feature

git rebase main

git commit -m “git rebase” .

git pull

git push

When there are merge conflicts

simply fix the merge conflicts, then:

eventually you’ll be done with the rebase, then do


git status

to see what the next steps are.