I have these branches:
- main
- feature-base (based on main)
- feature-foo (based on feature-base)
The branch "feature-base" contains a lot of commits which are not needed any more.
I want to create a new branch "only-foo" which contains the difference between "feature-base" and "feature-foo".
I thought about this solution
git checkout feature
git diff feature-foo > ~/tmp/foo.patch
git switch main
git switch -c only-foo
patch -p0 < ~/tmp/foo.patch
But this does not include binary files.
Is there a better way to apply the difference of two branches to a third branch?
It is fine to get the changes only. It is ok if commit-messages (and other meta-data) from "feature-foo" get lost.