How can I move some commits of a feature from an existing branch into a feature branch, and effectively remove them from the current branch - as if the feature was developed in a separate feature branch?
Background: the branch develop
contains commits to two features A (say, 50 commits) and B (10 commits) wildly mixed, since they originally should have been in the same release. Now we are delaying feature B. Thus, we want to have only feature A in the develop
branch, and a new featureB
branch that contains the commits of A or A and B, such that if we merge both branches, we get the current position of the develop
branch.
One way to do that would be to create the featureB
branch from the current position of the develop
branch and then reversely apply the commits from A to develop
. But then the merge of the new develop
and featureB
would just be A.
Another way would be to rename the current develop
into featureB
and cherry pick all commits of A into a new develop
branch. But that would effectively modify the history of develop
, which is troublesome.
What is a better way to do that?