WRITELOOP

CREATING AND APPLYING A PATCH

2018 July 11

I had a situation where I wanted to always apply a patch to file before sending it to somebody, but I didn’t want to commit those changes to git. So I decided to check how to create and apply a patch, which turns out to be very easy:

Create a patch file:

diff -Naur original_file changed_file > diff.patch

Apply the patch:

patch < diff.patch