31,003
edits
(Add Chinese) Tag: 2017 source edit |
Tag: 2017 source edit |
||
| Line 72: | Line 72: | ||
=== Install Pre-commit git hook === | === Install Pre-commit git hook === | ||
You can use git hooks to check the syntax of the file you commit and cancel the commit if something is wrong. You need '''phpcs''' command line tool for this (sudo apt-get -y install php-codesniffer). If you have '''phpcbf''' installed, you can also fix the files automatically. This is how to: | You can use git hooks to check the syntax of the file you commit and cancel (or better autofix) the commit if something is wrong. You need '''phpcs''' command line tool for this (sudo apt-get -y install php-codesniffer). If you have '''phpcbf''' installed, you can also fix the files automatically. This is how to: | ||
Go to '''/dev/setup/git/hooks''' of your local repository, copy the file '''pre-commit''' into your '''.git/hooks''' folder of the local git repository and make it executable. | Go to '''/dev/setup/git/hooks''' of your local repository, copy the file '''pre-commit''' into your '''.git/hooks''' folder of the local git repository and make it executable. | ||