You can merge the changes with the main branch into the branch of your function,
A
\
\-C
Suppose you created featureA from commit B to master, and that C, D and E are commits made on featureA, and F and G are commits that reorder methods, etc. Now you want to merge F and G into the feature branch.
$ git checkout featureA
$ git merge G (G is the sha1)
Or, you could cherry pick commits F and G in featureA. Remember that you will run into conflicts anyway and that this is just an alternative to your rebase option.
In the future, I would recommend that you do refactoring either directly on featureA or from another branch, separate from featureA:
A
\
\-C
\
\-I
Then this is a piece of cake to join in a refactoring branch in featureA, since merging would be trivial.
source
share