← Back to home

Patch example

This document demonstrates how to generate a patch from a Base64-encoded patch file, test applying it with a dry run, and then apply the patch for real.

Generate patch from Base64

echo "ZXhhbXBsZSB0ZXh0Cg==" | base64 -d > mypatch.patch

Test the patch

Test the patch without actually modifying any files:

patch -l --dry-run myfile < mypatch.patch

Apply the patch

Apply the patch to the target file:

patch -l myfile < mypatch.patch