How to apply a patch?

Suppose that you want to use e.g. a CiviCRM extension like CDNTaxReceipts , but you want some extra functionality, and someone told you that there is a patch available.

Now suppose you don't use git, and you don't have a clue about how a patch works. Then this is the easy way to apply it.

  1. You download the patch file, and you save it on your file system, e.g. as ~/Downloads/39.diff

  2. You use the command line. Supposing you unpacked the archive in ~/dev/CDNTaxReceipts-3.1

    cd ~/dev/CDNTaxReceipts-3.1
    patch -p1 < ~/Downloads/39.diff

Here you are. You patched the extension.

If you use Windows, the hardest part will be finding a patch executable. On almost every other OS, patch will be available by default.


Comments powered by Disqus