---
name: "clang-format-diff-13"
section: "1"
platform: "linux"
package: "clang-format-13"
version: "1:13.0.1-11+b2"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/clang-format-diff-13"
---

# clang-format-diff-13(1)

manual page for clang-format-diff.py 13

## NAME

clang-format-diff.py - manual page for clang-format-diff.py 13

## DESCRIPTION

usage: clang-format-diff.py \[-h\] \[-i\] \[-p NUM\] \[-regex PATTERN\]

- \[-iregex PATTERN\] \[-sort-includes\] \[-v\]

  \[-style STYLE\] \[-binary BINARY\]

This script reads input from a unified diff and reformats all the changed lines. This is useful to reformat all the lines touched by a specific patch. Example usage for git/svn users:

-

  git diff **-U0** **--no-color** **--relative** HEAD^ \| clang-format-diff.py **-p1** **-i** svn diff **--diff-cmd**=*diff* **-x-U0** \| clang-format-diff.py **-i**

It should be noted that the filename contained in the diff is used unmodified to determine the source file to update. Users calling this script directly should be careful to ensure that the path in the diff is correct relative to the current working directory.

### options:

- **-h**, **--help**

  show this help message and exit

- **-i**

  apply edits to files instead of displaying a diff

- **-p** NUM

  strip the smallest prefix containing P slashes

- **-regex** PATTERN

  custom pattern selecting file paths to reformat (case sensitive, overrides **-iregex**)

- **-iregex** PATTERN

  custom pattern selecting file paths to reformat (case insensitive, overridden by **-regex**)

- **-sort-includes**

  let clang-format sort include blocks

- **-v**, **--verbose**

  be more verbose, ineffective without **-i**

- **-style** STYLE

  formatting style to apply (LLVM, GNU, Google, Chromium, Microsoft, Mozilla, WebKit)

- **-binary** BINARY

  location of binary to use for clang-format
