Git: Get a patch between two branches
Get a patch from the diff between master
and foo
:
git diff --no-color --binary master foo > /tmp/patch
--no-color
ensures the diff is valid to apply if you have automatic coloring on, --binary
ensures binary files are handled correctly as well.
To later apply the patch:
git apply /tmp/patch