Run jshint
on changed files in the working directory, and prevent commits if no lint free.
To enable this hook, make this file executable by chmod +x .git/hooks/pre-commit
.
git init
curl https://raw.github.com/gist/1367701/pre-commit >> .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
git commit
http://hgbook.red-bean.com/read/handling-repository-events-with-hooks.html#sec:hook:simple
hg init
mkdir .hg/hooks
curl https://raw.github.com/gist/1367701/pre-commit >> .hg/hooks/pre-commit
chmod +x .hg/hooks/pre-commit
echo '[hooks]' >> .hg/hgrc
echo 'pre-commit = .hg/hooks/pre-commit' >> .hg/hgrc
cat .hg/hgrc
hg commit
note: the hg hook for precommit is actually pre-commit
, not precommit
.
NO COMMIT IF NO LINT FREE.