gendiff - Man Page

Utility to aid in error-free diff file generation

Synopsis

gendiff DIRECTORY DIFF-EXTENSION

Description

gendiff is a tool for generating a diff file from a single directory.​ The generated diff can be applied with the patch(1) program to recreate the changes.​

gendiff looks for any files with DIFF-EXTENSION as their extension in the specified DIRECTORY, and runs diff(1) on the files with DIFF-EXTENSION and the counterpart without it, in that order.​ This allows for generating diffs from source code without making a full copy of the directory, which you'​d otherwise need when using the diff(1) utility directly.​

gendiff is commonly used to creating patches for the purposes of packaging software with rpmbuild(1).​

Arguments

DIRECTORY

The directory to generate a diff from.​

DIFF-EXTENSION

The diff extension to look for.​

Exit Status

On success, 0 is returned, a nonzero failure code otherwise.​

Examples

Assuming you need to modify a source file called somefile.​cpp and have chosen the extension fix, copy it to somefile.​cpp.​fix before editing it.​ Then edit the original file (somefile.​cpp).​

After editing all the files you need to edit in this fashion, enter the directory one level above where the source code resides, and run gendiff on it:

  gendiff myproject-1​.0 ​.fix > myproject-1​.0-fix​.patch

See Also

diff(1), patch(1)

Referenced By

rpmbuild(1).

2026-08-20 RPM 6.1.0