patch
Apply differences between files (patching)
TLDR
Apply a patch using a diff file (filenames must be included in the diff file)
Apply a patch to a specific file
Patch a file writing the result to a different file
Apply a patch to the current directory
Apply the reverse of a patch
SYNOPSIS
patch [options] [original [patchfile]]
PARAMETERS
-p NUM
Strip NUM leading components from paths
-b, --backup
Create backup files
-d DIR
Change to directory before patching
-i FILE
Read patch from file
-R, --reverse
Assume patch was created reversed
-N, --forward
Ignore already-applied patches
-E, --remove-empty-files
Remove files that become empty
--dry-run
Don't actually change files
-v, --verbose
Verbose output
-s, --silent
Silent except for errors
DESCRIPTION
patch applies changes from diff files to original files. It reads a patch file containing differences between two versions and applies those changes to create the newer version. patch is essential for applying software updates, bug fixes, and modifications distributed as diff files.
CAVEATS
Patches may fail if source has changed. Use --dry-run to test first. The -p option usually needs adjustment. Fuzzy matching can cause incorrect placement.


