Reputation: 27852
Say I have a master branch and a feature branch called FA1 that is branched off master and I have another feature branch called FA2 that is branched off FA1.
When I'm working on FA2 and I want to bring changes from FA1, I do: git rebase -i FA1
.
However, at some point FA1 gets merged into master and I want to change FA2 to be based off master now, it no longer makes sense that is branched off FA1.
What is the proper approach to change the target branch of FA2 to be master OR in other words, for FA2 to be up to date with master.
Upvotes: 3
Views: 1875
Reputation: 2996
Make FA2 derive directly from master :
git checkout FA2
git rebase FA1 FA2
git rebase --onto master FA1 FA2
see the rebase documentation
Upvotes: 5
Reputation: 29791
Just do
git fetch
git rebase origin/master
Background: Git does not store anywhere which branch you rebased onto in the past, so it does not know you rebased onto FA1
previously, and as such there is noting special to do when you want to switch the base to rebase into, expcept, well to specify that new base to rebase
.
Upvotes: 2
Reputation: 21908
[...] it no longer makes sense that is branched off FA1 [...]
This is not quite true. Whether branch FA2
still exists or not, FA1
stays branched off the same commit.
If you then need to bring into FA2
recent commits merged into master
, yes, you can indeed rebase FA2
on master
as you did before with FA1
.
Upvotes: 0