Skip to content

Instantly share code, notes, and snippets.

Created June 11, 2018 04:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Using clang-format

Use clang-format on full code base

$ sudo apt-get install git-clang-format
$ clang-format --version
clang-format version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
$ clang-format -i *.cpp *.h

To use clang-format with git changes only, use git-clang-format

Check if already installed

$ which git-clang-format
$ which git-clang-format-3.8
$ ls -l /usr/bin/git-clang-format-3.8
lrwxrwxrwx 1 root root 36 Jul 12  2016 /usr/bin/git-clang-format-3.8 -> ../lib/llvm-3.8/bin/git-clang-format

If not installed install git-clang-format

$ git add .
$ git-clang-format-3.8
changed files:
$  git add anyoption.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment