CLANG-FORMAT-DIFF.PY(1)
π NAME π
clang-format-diff.py β it's the manual page for clang-format-diff.py 20, bestie, and it's literally gonna be your new fave β¨
π¦ DESCRIPTION π¦
okay so here's the whole vibe. The usage goes a lil 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 this lil script do, you ask? Obsessed that you asked. It reads input from a unified diff and reformats all the changed lines. Basically it's the glow-up for every line that a specific patch touched. No cap, it's genuinely so useful. πΈ
Here's the 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 real talk, this part matters: the filename contained in the diff gets used unmodified to figure out which source file to update. So if you're calling this script directly, you need to be careful and make sure the path in the diff is correct relative to the current working directory. It's giving "trust me bro" energy and you should not. π
β¨ options β¨
-h,--helpβ shows this help message and dips. iconic behavior honestly π-iβ actually applies the edits to your files instead of just displaying a diff. main character move π-p NUMβ strips the smallest prefix that contains P slashes-regex PATTERNβ your own custom pattern for picking which file paths to reformat (case sensitive, and it overrides-iregex) π₯-iregex PATTERNβ same deal, custom pattern for picking file paths to reformat, but case insensitive (and it gets overridden by-regex, so know your hierarchy bestie) π«Ά-sort-includesβ letsclang-formatsort the include blocks. organized queen π-v,--verboseβ be more verbose, but lowkey it does nothing without-iπ-style STYLEβ the formatting style to apply:LLVM,GNU,Google,Chromium,Microsoft,Mozilla,WebKitβ-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. it's giving backup plan, we love to see it π-binary BINARYβ location of the binary to use forclang-formatπ§
and that's the whole page bestie!! this was clang-format-diff.py version 20, dated September 2026. go reformat something cute, ily, mwah πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: clang-format-20 1:20.1.8-2ubuntu13 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms