This pre-commit hook, formating php-cs-fixers all php files before commit to git. Formating rules is in setting file .php_cs
- pre-commit - This hook is called before obtaining the proposed commit message.
Download and install files from github
git clone [email protected]:otazniksk/git-hooks.git
cd git-hooks
composer install
###Create symlink for OS Windows
Suppose the whole path to the file for our git-hooks is this:
C:\wamp64\www\_helpers\git-hooks
Suppose the whole path to your_project and git hooks is this:
C:\wamp64\www\your_project\.git\hooks
You must delete the entire hooks directory before creating a symlink
rmdir /s "C:\wamp64\www\your_project\.git\hooks"
ATTENTATION!! only for OS Windows
MKLINK /D C:\wamp64\www\your_project\.git\hooks C:\wamp64\www\_helpers\git-hooks
###Create symlink for Linux
Suppose the whole path to the file for our git-hooks is this:
/var/www/_helpers/git-hooks
Change permission
sudo chmod +x /var/www/your_project/.git/hooks/pre-commit
Suppose the whole path to your_project and git hooks is this:
/var/www/your_project/.git/hooks
You must delete the entire hooks directory before creating a symlink
sudo rm -rf /var/www/your_project/.git/hooks
ATTENTATION!! only for LINUX
cd /var/www/_helpers/git-hooks
sudo ln -s /var/www/your_project/.git/hooks
To apply in PhpStorm, you need to restart PhpStorm