How to rebase branch

Updated: 11th November 2023
Tags: git

Sometimes after code in pushed to master/main and you were working on branch on similar file, it will cause conflict. So you need rebase on merge or rebase your branch.

To rebase your branch with master

git fetch origin
git rebase -i origin/master
# in the vim use: `:wq`
# on conflict: check and resolve them
git add . # add resolved files
git rebase --continue