Thursday, August 8, 2013

Patch file in Linux

Patch takes a patch file patchfile containing a difference listing produced by the diff program and
applies those differences to one or more original files, producing patched versions.
Normally the patched versions are put in place of the originals.

Example to create patch file:
$ diff -urN alsa-utils-1.0.27.2-src-ori/build_core alsa-utils-1.0.27.2-src-patch/build_core
where,
alsa-utils-1.0.27.2-src-ori is original code,
alsa-utils-1.0.27.2-src-patch is chaned code.

The following usage is most commonly used:
$ patch -p1 < {/path/to/patch/file}

To apply a patch, one could run the following command in a shell:
$ patch < /path/to/file

Patches can be undone, or reversed, with the '-R' option:
$ patch -R < /path/to/file

Above 3 are basic usage read the man page of patch command for more information and usage:
% man patch

https://www.git-tower.com/learn/git/faq/change-author-name-email

No comments:

Post a Comment