Create a diff or patch file on GitHub

Ever needed to email a commit to someone? Well, today I did. TIL how to quickly generate a diff file for a commit page, Pull Request or a Compare View.

Today I had to email a commit to a email list. I could have made a screenshot of the commit page on GitHub, but hey, that is not really nice. I found out that GitHub made a way to quickly generate diff and patch files. Just add .diff or .patch at the end of the URL for a commit page, Pull Request or a Compare View.

An excerpt of an example:

From 1bf0d8214235cdff2cdd69f3b0cd444532c2 Mon Sep 17 00:00:00 2001
From: Jonh Doe <jonh.doe@hotmail.com>
Date: Fri, 22 Dec 2017 13:30:45 +0100
Subject: [PATCH 1/2] Refactor issue #123
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/views/auctions/home.html | 4 +++-
 app/views/main.html          | 8 +++++++-
 public/scripts/app.js        | 1 +
 3 files changed, 11 insertions(+), 2 deletions(-)

(...)

h/t to GitHub


SHARE THIS ARTICLE