This is a reminder for myself. Sometimes, rarely I discover bugs while running free software, if I can fix the bug it would be a pity not to attach a patch to the bugtracker to make the work of developers easier.

Creating a patch file:

diff -u old.file new.file > new.patch

Apply a patch using the patch command:

patch -p0 < patchfile

That is all one need to know to create and apply a patch on top of working directory.