patch (Unix)

The Unix program patch manipulated source code against a patch. It is thus the counterpart to the diff program that generates patches.


The first implementation was written by Larry Wall and ran on Unix-like operating systems. Meanwhile, it has been ported to many platforms and is part of the POSIX standard and most IDEs. The program can apply many different formats of patches and has become a popular way to exchange among developers changes to a program with each other. patch was especially popular within the free software community because it allows developers to quickly and easily contribute to a project without having write access to the version control of the project.


To apply a patch, this command is sufficient:

$ Patch -p1 < bearbeitungen.diff This command brings patch to apply the changes to the files that are specified bearbeitungen.diff in the patch, and skip the first directory component of the path to the files. Patches are often created so that the root of the source tree is included in the patch, but the files should be patched from within the root directory, you must patch -p1 of the parameters are passed.

With the -R parameter can take one back once applied patches changes.

Interoperability with Windows

When using patches that have been created on a Windows machine, it is sometimes necessary, the CR / LF problem to deal with, so the patch is applicable. This is done for example by

  • Patch (1 ) - Debian GNU / Linux Executable programs or shell commands manual page
  • UNIX software