1 2 3 4
#!/bin/bash # get names of staged files | filter out the header and cpp files | clang-format them git diff --staged --name-only | grep --regex="\.h\|\.cpp" | xargs clang-format -i