Two things I notice:
- You appear to be thinking of
F1
as being only those commits which you have added to the branch
- You are, as a result, trying to keep the
F1
branch "clean" by actively preventing any code you didn't create for that feature from being part of the F1
branch
The reason this is causing difficulty is you're actually working somewhat against both the git model and how git flow is intended to work.
To address the first issue, a branch (in git's brain) is just a label pointing to a commit, and the branch contains that commit, its parent(s), and its parents' parent(s), etc. all the way back to the initial commit. So your branch isn't "my code" it's "the project history, plus my code."
When using git flow, develop becomes the defacto master branch for the development team. So essentially, once something has been merged into develop it's the "official" code of the project even though it has not been released.
So if F2
F3
and F7
have all been merged into develop
, testing F1
with only F2
will never be able to give you a complete picture of how your code will integrate into the main line code.
To continue our reasoning, in your situation, instead of your branch containing "the project history, plus my code" it contains "some outdated version of the project history, plus my code." To use a somewhat flawed analogy, you're designing an car cover for a 2018 Mustang by bolting the 2018 fender onto a 1977 Mustang and hoping for the best.
The recommended mechanism for preventing your feature from becoming out of date is to regularly either merge develop into your feature branch, or to rebase your feature branch onto the new head of develop (depending on if you've shared your code and the workflow preferences of your team). The developer of the feature branch is always responsible for resolving conflicts and ensuring integrity of the features already merged to develop.
Addendum
As you've stated that keeping your branch clean is a team requirement, rebase is your new best friend.
$ git checkout F1
$ git fetch
$ git rebase origin/develop
This will fulfill the team requirement to keep your commits together and your branch "clean" from a history perspective while allowing you to test against all code added to develop after you created your branch. All without the dance and the need to roll things back.