git format-patch <base_branch_name>
Typically you'll specify master
, as you'll be executing this command from your feature branch.
It'll generate a file for each new commit.
Use the following (--stdout
) to get all new commits into a single patch file:
git format-patch master --stdout > new-feature.patch
The patch can then be applied like so:
git checkout review-new-feature
cat new-feature.patch | git am
or if you received multiple files:
cat *.patch | git am
Now you can check the result:
git log --oneline
Note: this gist is a shortened summary of this article