$ cd qemu $ cat >.git/hooks/pre-commit #!/bin/bash exec git diff --cached | scripts/checkpatch.pl --no-signoff -q - ^D $ chmod 755 .git/hooks/pre-commit
Any commit that violates the coding standard as checked by checkpatch.pl will be aborted. I am running with this git hook now and will post any tweaks I make to it.
Update: If you encounter a false positive because checkpatch.pl is complaining about code you didn't touch, use git commit --no-verify to override the pre-commit hook. Use this trick sparingly :-).