Actually, this is patch < the_patch or cat the_patch | patch cat the_patch | patch .
You may need to use the -p<n> parameter, which is used to highlight path segments stored in the patch. For example, if a patch was created from one level above the source tree (for example, you distinguished one tree from another), and you want to apply the patch from the source tree, you need -p .
Another useful option is --dry-run . This will act as an application, but will not modify any files. Itโs good to check if the -p option is set correctly, and see if the patch will be applied cleanly.
What I usually do is change the root of the source tree and then run cat <file> | patch -p1 --dry-run cat <file> | patch -p1 --dry-run . If I get errors about files not found, I will switch to -p0 . As soon as any of these works, I --dry-run and do it for real.
source share