Joe
Joe

Reputation: 31

Git rebase feature branch to another branch

I have forked repo A. I have pulled it locally and checked out branch b1. I have created a new feature branch of b1 (and not master):

git checkout -b my-feature b1

I have made a PR and pushed my changes to my own forked branch.

1 month has passed, my PR isn't merged yet, now I need to do a rebase, how do I do it?

I need to rebase to b1 and not master.

I have tried the following:

git fetch
git rebase origin/b1

but it keeps saying

Current branch my-feature is up to date.

Upvotes: 3

Views: 7742

Answers (2)

Aaditya Thakkar
Aaditya Thakkar

Reputation: 1820

You can do it like this:

git checkout my-feature
git pull origin b1 --rebase

The later command will pull the new commits of b1 branch from the remote (origin) and will make your current branch rebase onto that. You might run into some merge conflicts during the rebase which you need to solve.

Upvotes: 7

Meliodas
Meliodas

Reputation: 337

Try:

git checkout my-feature
git fetch origin
git rebase origin/b1

If it doesn't work, check if there really are new commits in origin/b1 that should be included into your my-feature branch.

Upvotes: 0

Related Questions