Clang Format
Installation in Ubuntu
Set up Git Hook
copy file
git-clang-format
to/usr/local/bin
copy file
pre-commit
to.git/hooks
of the repository under developmentgenerate
.clang-format
file in the root directory of the project
File: pre-commit
File: git-clang-format
File: .clang-format
Example of full configuration: https://github.com/hanzheteng/LOCUS/blob/main/.clang-format
Usage
If git hook is set, run the following command before every git commit.
In addition to being used as a git hook, clang can format a single c++ file in command line.
To disable clang formatting in certain cases.
References
Official documentation
Tutorials
A script to automatically install clang-format and set up git hook
Last updated