Create and Apply Git Patches: Difference between revisions
Jump to navigation
Jump to search
Line 11: | Line 11: | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
git format-patch -<n> --stdout > ./file.patch | git format-patch -<n> <reference-sha-1> --stdout > ./file.patch | ||
</syntaxhighlight> | |||
<syntaxhighlight lang='bash'> | |||
git format-patch -1 HEAD --stdout > ./file.patch | |||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 21:50, 16 January 2024
Internal
Overview
Patches can be created with git format-patch
and applied with git am
or git apply
.
Create the Patch
Specify how many commits from head to include in the patch:
git format-patch -<n> <reference-sha-1> --stdout > ./file.patch
git format-patch -1 HEAD --stdout > ./file.patch