Git Git Patch Creating a patch


Example

To create a patch, there are two steps.

  1. Make your changes and commit them.
  2. Run git format-patch <commit-reference> to convert all commits since the commit <commit-reference> (not including it) into patch files.

For example, if patches should be generated from the latest two commits:

git format-patch HEAD~~ 

This will create 2 files, one for each commit since HEAD~~, like this:

0001-hello_world.patch
0002-beginning.patch