Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rebasing into feature branch

Tags:

git

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?

like image 257
Jason Y Avatar asked Sep 03 '25 04:09

Jason Y


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.

like image 198
VonC Avatar answered Sep 04 '25 19:09

VonC