Get patch file of a commit on github

To download patch file of a commit on github, just add .patch to its URL (without arguments like ?diff=unified).

  • Common URL: https://github.com/<owner>/<repo>/commit/<commit_id>.patch

  • For example, the patch file for commit
    https://github.com/dothanhtrung/godebian/commit/cf0495a9e2f5996fbb3e00f21e92b9aa259a6c2b
    is at
    https://github.com/dothanhtrung/godebian/commit/cf0495a9e2f5996fbb3e00f21e92b9aa259a6c2b.patch

github