一、代碼提交格式檢查:
1、tar zxvfp tool.tar.gz
2、把解壓的tool目錄放到你的工程目錄根目錄
3、把pre-commit這個文件cpcopy到repo的.git/hooks/目錄下.
4、執行git commit時就會執行格式檢查了,如果格式不符合就會終止提交
二、代碼格式化
1、//應爲配置文件支持的語法是clang-format-5以上版本
sudo apt-get install clang-format-5.0
2、把tool文件中的 .clang-format 到工程目錄根目錄
3、cd 到工程目錄
4、git config clangFormat.binary clang-format-5.0
5、git config clangFormat.stylePath ./.clang-format
6、格式化所有已經stage的文件
git clang-format-5.0
7、格式化整個 repo
git clang-format-5.0 --commit git hash-object -t tree /dev/null