Category Archives: Git hooks

Git post-receive hook to update your website after commit

The assumption is that you have your repository for instance in: ~/repos/www.example.com/repository.git and your working copy of this repository in: ~/www.example.com In this case you have to create a file named post-receive in: ~/repos/www.example.com/repository.git/hooks and put following code inside it: #Update your website code GIT_WORK_TREE=/home/USER_NAME/www/www.example.com/ git checkout -f if you also are interested in re-creating… Read More »

Git Pre-commit hook

Yesterday I have written first code in Bash Script :D. It was a pre-commit hook which checks my Javascript files against bugs using JSLint. To install it, please download JSLint from http://www.javascriptlint.com/ and copy executable file (I renamed it from jsl to jslint) and config file to: your_project/.git/hooks and put following code into the pre-commit… Read More »