How do patches work in Git?
The easiest method to create patches from the last commit (or last few commits) is to use format-patch
with a negative number indicating the number of commits to create patches for:
git format-patch -1
You'll get a patch file named after the commit description. The use am
to insert it into another repository:
git am << name_of_patch_file
Create your patch via:
$ git format-patch master --stdout > patch.diff
then patch.diff will contain the diff, which you can then send to someone else to apply using:
$ git am < patch.diff
Sometimes, when the manuals are a little dense, it makes sense to look for a tutorial:
http://luhman.org/blog/2009/09/22/git-patch-tutorial