ortogonal added a comment. Thanks for looking into this!
The feature `--staged` adds the possibility to ONLY run clang format on what is staged. Lets say you have main.cpp where you have done two changes. You stage one of them using: $ git add -p main.cpp You now have a state were one of the changes is staged for commit but not the other. $ git status On branch master Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: main.cpp Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: main.cpp If you now run `git-clang-format` it will format all changes in main.cpp, but at this stage adding `--staged` to git-clang-format lets you only format what is staged in that file. I use this together with a git pre-commit-hook to make sure that all my code changes are formatted correctly before I commit. But without the `--staged` option I end up in situations were my pre-commit-hook fails because I have part of a files staged and a formatting error in the part of the file that is not staged. Does this make the need for `--staged` clearer? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D90996/new/ https://reviews.llvm.org/D90996 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits