- Published on
How to do a git rebase
143 words • 1 min read
Steps to rebase your current working branch with master
git checkout mastergit pull origin mastergit checkout YOUR_BRANCHgit rebase masterFix conflicts if there are any.
If there are conflicts at this stage, and you've fixed them, you can run
git rebase --continueto complete the rebase, or if you want to abort the rebase you can rungit rebase --abortFinally force push to the origin of your branch. Here we are doing force push because essentially we are changing the history of our commits when we do the rebase
git push -f origin YOUR_BRANCHAll your commits should be rebased with the commits in master branch now
Here is a video about rebasing in a a slightly different technique, which can be used if you have a lot of conflicts.