#!/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