CLANG-FORMAT-DIFF.PY(1)
π NAME π
okay bestie, listen up β this is the manual page for clang-format-diff.py version 21. that's it. that's the whole name. slay. β¨
π¦ DESCRIPTION π¦
so like, the way this works is: it reads input from a unified diff and reformats all the changed lines. it's giving "glow-up but only for the lines your patch touched." π super useful when you wanna reformat exactly the lines a specific patch messed with, and literally nothing else.
here's the usage situation, no cap:
clang-format-diff.py [-h] [-i] [-p NUM] [-regex PATTERN]
[-iregex PATTERN] [-sort-includes] [-v]
[-style STYLE] [-fallback-style FALLBACK_STYLE] [-binary BINARY]
and here are the example usages for all my git/svn besties out there:
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 so this part is important, don't skip it: the filename contained in the diff is used unmodified to determine the 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, do not sleep on this one. π
β¨ options: β¨
-h,--helpβ shows this help message and then dips (exits). iconic behavior honestly π«Ά-iβ applies the edits straight to the files instead of just showing you a diff. it's giving "we're actually doing this, not just talking about it." π₯-p NUMβ strips the smallest prefix that containsPslashes. buh-bye prefix π-regex PATTERNβ your own custom pattern for picking which file paths get reformatted. case sensitive, and it overrides-iregex. it said "i'm the main character." π-iregex PATTERNβ same deal, custom pattern for selecting file paths to reformat, but case insensitive. and heads up: it gets overridden by-regex. sorry babe, second place. π-sort-includesβ letsclang-formatsort the include blocks. let it cook. π-v,--verboseβ be more verbose. just a lil heads up tho: it's ineffective without-i. so don't bother being chatty if you're not even applying edits, bestie π-style STYLEβ the formatting style you wanna apply. your options areLLVM,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't find the.clang-formatfile to use. it's the backup bestie that shows up when the original cancels. π§-binary BINARYβ the location of the binary to use forclang-format. tell it where your little guy lives π
and that's the whole vibe check! this page is from clang-format-diff.py version 21, dated September 2026. periodt. πβ¨ππ¦πΈπ
π¦ where this page comes from
- ubuntu stonking: clang-format-21 1:21.1.8-10ubuntu2 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms