Git · Patches and plumbing
git format-patch
Exports commits as email-ready patch files.
Syntax
git format-patch <range>Example
Example
git format-patch origin/main --stdout > changes.patch
More in this group
Learn this in the course
Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.