How to rebase local branch onto remote master

First fetch the new master from the upstream repository, then rebase your work branch on that:

git fetch origin            # Updates origin/master
git rebase origin/master    # Rebases current branch onto origin/master

Update: Please see Paul Draper’s answer for a more concise way to do the same – recent Git versions provide a simpler way to do the equivalent of the above two commands.

Leave a Comment