Rebasing into feature branch

Viewed 1290

If I'm working on a feature branch for a long period of time (weeks) and I want to regularly rebase master into my branch, should I always switch to master, pull latest, then switch back to the feature branch and rebase master?

1 Answers

I would simply do, assuming I am already on the feature branch:

git fetch && git rebase origin/master

You could, as commented, fetch only master with git fetch origin master:master, but I prefer fetching everything to have a complete local representation of the remote repository.

And since you are not working on master directly, you can ignore master, and rebase on top of origin/master, which was updated by the fetch.

Related