GENDIFF(1) General Commands Manual GENDIFF(1)

# [NAME](#NAME)

gendiff - Utility to aid in error-free diff file generation

# [SYNOPSIS](#SYNOPSIS)

**gendiff** *DIRECTORY* *DIFF-EXTENSION*

# [DESCRIPTION](#DESCRIPTION)

**gendiff** is a tool for generating a *diff* file from a single directory. The generated *diff* can be applied with the [**patch**(1)](/man/os/rpm/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)](/man/os/rpm/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)](/man/os/rpm/diff.1) utility directly.

**gendiff** is commonly used to creating patches for the purposes of packaging software with [**rpmbuild**(1)](/man/os/rpm/rpmbuild.1).

# [ARGUMENTS](#ARGUMENTS)

*DIRECTORY*

The directory to generate a diff from.

*DIFF-EXTENSION*

The diff extension to look for.

# [EXIT STATUS](#EXIT_STATUS)

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

# [EXAMPLES](#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](#SEE_ALSO)

[**diff**(1)](/man/os/rpm/diff.1), [**patch**(1)](/man/os/rpm/patch.1)

2026-10-04 RPM 6.1.0

---

Document: gendiff(1) from rpm 6.1.0-r2 (Chainguard OS)
Source: https://github.com/rpm-software-management/rpm
