# man > diff2patches(1)

---
type: CommandReference
command: diff2patches
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `diff2patches filename` — Extract patches from a `.diff.gz` file that apply outside `debian/`
- `diff2patches --help` — Display help and exit
- `diff2patches --version` — Display version info and exit
- Patches are named with `___` replacing `/` and have `.patch` extension
- Patches are extracted to `debian/patches/` (preferred), `debian/`, or a directory set by `$DEB_PATCHES`

## Name

Extract non-debian/ patches from .diff.gz files

## Synopsis

`diff2patches filename`
`diff2patches --help | --version`

## Options

- `filename` — Extract patches from the given `.diff.gz` file that apply outside the `debian/` directory
- `--help` — Output help information and exit
- `--version` — Output version information and exit

## Environment Variables

- `DEB_PATCHES` — When defined and points to an existing directory, patches are extracted there instead of under `debian/` or `debian/patches/`

## Files

- `debian/control` — Existence of this file is tested before any patch is extracted
- `debian/` — Patches may be extracted to this directory (fallback)
- `debian/patches/` — Preferred directory for extracted patches (if it exists)

## See Also

[`combinediff(1)`](http://localhost/phpMan.php/man/combinediff/1/markdown)