CLANG-FORMAT-DIFF.PY(1)
π NAME π
clang-format-diff.py β bestie, this is the manual page for clang-format-diff.py 19, and she is that girl π
β¨ DESCRIPTION β¨
okay so the vibe here is, the usage goes a little something like this:
clang-format-diff.py [-h] [-i] [-p NUM] [-regex PATTERN]
[-iregex PATTERN] [-sort-includes] [-v]
[-style STYLE] [-fallback-style FALLBACK_STYLE] [-binary BINARY]
so what does she <em>do</em>?? This script reads input from a unified diff and reformats all the changed lines. Which is lowkey the most useful thing ever, because it means you can reformat literally every line touched by one specific patch and not one single line more. no cap. π«Ά
Example usage for all my git/svn girlies:
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
π¨ okay bestie, important: the filename inside the diff is used unmodified to figure out which source file to update. so if you're calling this script directly, you gotta be careful and make sure the path in the diff is correct relative to the current working directory. fr fr, check it. π
πΈ options: πΈ
-h,--helpβ show this help message and exit. the classic. the icon. π-iβ apply edits to files instead of displaying a diff. this is the "no, actually change it" button π-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β letclang-formatsort include blocks ποΈβ¨-v,--verboseβ be more verbose, ineffective without-i(so like, she's yapping but nobody's listening unless-iis on, iykyk)-style STYLEβ formatting style to apply (LLVM, GNU, Google, Chromium, Microsoft, Mozilla, WebKit) β pick your fighter π₯-fallback-style FALLBACK_STYLEβ The name of the predefined style used as a fallback in caseclang-formatis invoked with-style=file, but can not find the.clang-formatfile to use.-binary BINARYβ location of binary to use forclang-formatπ
and that's the whole page, bestie!! this was clang-format-diff.py 19, dated June 2025, from the User Commands corner of the manual π go forth and reformat only the lines you touched, main character energy only β¨π¦π
π¦ where this page comes from
- debian bookworm: clang-format-19 1:19.1.7-3~deb12u1 Β· APACHE-2-LLVM-EXCEPTIONS
- debian trixie: clang-format-19 1:19.1.7-3+b1 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms