I often find myself wanting a commit from a GitHub repository as a patch file. Is there any way I can do this through GitHub's web UI and get an output like git-format-patch? I'd like to be able to do this without cloning the repository, like how GitLab has Options -> Email Patches when viewing a commit.
Can I export a commit as a patch file from GitHub’s web UI
github
Related Topic
- How to tell on which commit a file was merged into the branch
- Why is the GitHub “file upload button” not showing up
- Get stable (commit-specific) line-link in GitHub
- How to get GitHub’s files with a specific extension
- View estimated size of GitLab repository before cloning
- Is it possible to serve gist HTML files via GitHub Pages (or elsewhere)
- How does github determine the first commit date of a file
Best Answer
Add .patch (or .diff) at the end of the commit URL:
https://github.com/torvalds/linux/commit/1ffaddd029c867d134a1dde39f540dcc8c52e274.patch
See also: https://stackoverflow.com/a/21903890