Reputation: 300
I'm still getting my head around using git-rebase, and I'd like to double check what I'm planning on doing before I actually do it!
The relevant branches in my repo currently look like this:
o---o---o...... master
\
o---o---o---o---o---o---o---o---o develop
\
o---o feature
\
* sub-feature
What I would like to achieve is this:
o---o---o...... master
\
o---o---o---o---o---o---o---o---o develop
\
o'---o' feature
\
* sub-feature
I'm not expecting any conflicts, as the feature
branch is only deleting files that are no longer required, and the sub-feature
branch has added new files which definitely don't exist on the develop
branch.
Based on the git-rebase documentation, I think I need to runthe following from the sub-feature
branch:
git rebase feature
I'm a little unsure though, because I want to rebase on to develop
and not master
. With this in mind, I'm wondering if should instead run the following from the sub-feature
branch:
git rebase --onto develop feature
Any help would be greatly appreciated!
Upvotes: 3
Views: 53
Reputation: 25373
onto
is very powerful, but since you are still getting used to rebasing, and this operation will require two steps regardless (assuming you want to update both feature
as well as sub-feature
) I would recommend these steps:
First let's update feature
:
git checkout feature
git rebase develop
Finally, update sub-feature
:
git checkout sub-feature
git rebase feature
This will leave you with the tree you stated in the question.
Upvotes: 2