Skip to content

Instantly share code, notes, and snippets.

View finchandfriends's full-sized avatar

Marcin finchandfriends

View GitHub Profile
@finchandfriends
finchandfriends / pre-commit
Created March 14, 2018 22:02 — forked from fdemiramon/pre-commit
Pre-commit hook for git with phpcs and phpcbf (auto-correct obvious violations)
#!/bin/sh
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
# Determine if a file list is passed
if [ "$#" -eq 1 ]
then
oIFS=$IFS
IFS='