Here is how to provide the output of “git diff –cached” to checkpatch script in a single command:
$ git diff –cached | ./scritps/checkpatch.pl –
The same can be added to .git/hooks/pre-commit (also change the file mode to 755), so that even if the checkpatch’ing was forgotten, there is no need to worry
Any commit that violates the coding standard as checked by checkpatch.pl will be aborted.
To forcefully commit the change, “–no-verify” can be added to the commit command.