You can do this by hand by branching off E
and cherry-picking the other commits into the new branch, then merging that into master
. Rebasing is also possible, i.e. do
git rebase C
on branch-a
. However, that will take commits from master
and put them on your feature branch.
git rebase -i C
has the same effect, but allows you to skip commits that you are no are from master
and are not required on branch-a
. Git cannot in general know whether commits interact in any way (e.g. a change to one file might require a change to a different file that was done on master
), so there's no fail-safe, fully automatic solution to this problem.