Skip to content

Create patch from latest commit

Published: at 08:36 AM

Git allow to save commit into a file called patch that can be applied to different branch.

To save latest commit into a patch:

git format-patch -n HEAD^ --stdout ~/Desktop/0001-first.patch

Then we can apply this patch to other branch by running:

git apply ~/Desktop/0001-first.patch