Home > Software engineering >  git fetch from remote, how do I then rebase?
git fetch from remote, how do I then rebase?

Time:03-10

I have a branch on my remote fork (which is behind my local master) and want to fetch the changes in that repo to my local machine. I do this using:

git fetch origin/branch-name
git checkout origin/branch-name
git switch -c "new-branch"

This does pull in the changes, but since this branch is behind master I cannot rebase onto master.

If I pull from the remote branch I get an Already up to date.

Is it possible to pull these changes from origin/branch-name in a way that allows me to rebase to master later?

CodePudding user response:

This does pull in the changes, but since this branch is behind master I cannot rebase onto master

You should still be able to rebase like that; it does not mater if the target commit is not in your ancestry.

What are you trying to do; rebase your newly-fetched origin/branch-name onto origin/master?

git checkout branch-name
git rebase master
  • Related