I have 2 branches : feature1 and feature2 which are based on the develop branch. feature1 is based on an older commit while feature2 is more recent.
I want to get only the commits from feature2 that are not in develop onto feature1.
I tried git rebase --onto feature1 develop feature2 as suggested in this answer, but I see that commits from develop are still getting applied onto feature1. What am I missing here?
Update : It turns out that the local develop branch was not up-to-date with the remote develop while feature2 was based on a more recent commit on the remote develop. This is why the commits from the remote develop were getting rebased.
As knittl mentions in the comments,
git rebase --onto A B Calways takes the commit rangeB..C(i.e.^B C)That means it should target commits from
D(excluded) up tof2HEAD (none of those commits should be fromdevelop, reachable fromdevelop):So:
However, the OP adds:
So: