Previous: Inexact, Up: Imperfect

10.3.4 Predicting what patch will do

It may not be obvious in advance what patch will do with a complicated or poorly formatted patch. If you are concerned that the input might cause patch to modify the wrong files, you can use the --dry-run option, which causes patch to print the results of applying patches without actually changing any files. You can then inspect the diagnostics generated by the dry run to see whether patch will modify the files that you expect. If the patch does not do what you want, you can modify the patch (or the other options to patch) and try another dry run. Once you are satisfied with the proposed patch you can apply it by invoking patch as before, but this time without the --dry-run option.