eager2learn
eager2learn

Reputation: 1488

git fetch from remote, how do I then rebase?

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?

Upvotes: 1

Views: 256

Answers (1)

RJFalconer
RJFalconer

Reputation: 11711

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

Upvotes: 1

Related Questions