What is a patch?

A path is a textual representation of the differences in two versions of the same file(s). They allow a developer to quickly see the modifications that have been made. Sending patches instead of the complete modified files also makes applying those changes to the source code much easier for the maintainers, especially if other changes have ben made in the mean time.

Suppose you download version 1.0 of Crimson Fields. You discover that it lacks a Klingon translation, so you decide to add one. Among other things you need to add bits to the unit set description. You update the respective file and send it back to the maintainer who could just replace the current file with your version, because, well, it's more up-to-date, right? It might be, but then again, it might not. Suppose that, two days before you did, someone else downloaded the same files and found it lacking an Eldarin translation. He modified the unit set and sent it to the developers who put it in their repository. Now, if they would just replace the unit set file again, they would lose all the changes made between the 1.0 release and the time they replace the file. Eldarin would stay a dead language. Using patches gets rid of this problem, because the Eldar can modify the Eldarin parts while the Klingons can modify the Klingon parts without interfering with each other (mostly, anyway).

How do I create a patch?

Patches are created using the diff utility which should exist for all platforms out there. Calling

diff -urNp file.old file.new >mypatch.diff

will create a patch containing all the differences between file.old and file.new (see below for the meaning of the parameters). Such a patch can be applied using the patch utility like this

patch <mypatch.diff

For further information about diff and patch please refer to the appropriate documentation.

Is there anything else I should consider when creating patches?

Definitely. The following guidelines are much appreciated by the developers.

Thanks for listening. We are looking forward to your contributions.