git rebase

../../_images/patching.png

Patching commands

git rebase –interactive HEAD~<number_of_local_commits>

git rebase --interactive HEAD~<number_of_local_commits>

Examples

Rebase our current branch onto another branch

To rebase the ‘feature’ branch onto ‘dev’ branch :

git checkout feature
git rebase dev

Then, the next time you will push your code to the remote repository, you will have to force the push in order to rewrite the git history.

git push --force