Diff and Patch

These examples is going to how to create a diff file with the differences between the original source directory and the patched directory. And how to patch the original source directory with the changes done in the patched directory.

Creating the diff file:

diff -Nuar source -orig/ source -patched/ > patch-file.diff

The patch is ‘applied’ using the ‘patch‘ command.
cd into the original directory (without the changes)

patch -p 1 < ../patch-file.diff

The ‘-p 1‘ option removes 1 path/directory from the top of the patch.

Comments (0)

› No comments yet.

Leave a Reply

Pingbacks (0)

› No pingbacks yet.

%d bloggers like this: