Skip to content

This pre-commit hook, formatting php-cs-fixer committed php files before commit to git

Notifications You must be signed in to change notification settings

otazniksk/git-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AUTO FORMATING PHP SCRIPTS BEFORE COMMIT

This pre-commit hook, formating php-cs-fixers all php files before commit to git. Formating rules is in setting file .php_cs

Useful Git Hooks scripts

  • pre-commit - This hook is called before obtaining the proposed commit message.

Instalation this Git Hooks scripts

Download and install files from github

1. Download git-hooks
git clone [email protected]:otazniksk/git-hooks.git
1. Run composer install
cd git-hooks
composer install

Create symlink

###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"

Creating a symlink so that our git-hooks use our .git in the project

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

Creating a symlink so that our git-hooks use our .git in the project

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

About

This pre-commit hook, formatting php-cs-fixer committed php files before commit to git

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages