git format-patch -1 HEAD or git format-patch -1 <sha> Applying patch: git am < file.patch https://stackoverflow.com/questions/6658313/generate-a-git-patch-for-a-specific-commit