Skip to content

Instantly share code, notes, and snippets.

@jatubio
Created June 16, 2015 00:08
Show Gist options
  • Save jatubio/9c96f43e3623bf43e41c to your computer and use it in GitHub Desktop.
Save jatubio/9c96f43e3623bf43e41c to your computer and use it in GitHub Desktop.
git post-commit hook to run PHP-CS-Fixer on windows after one commit
@Echo off
REM ADD PHP TO PATH See PHP-CS-Fixer bug on https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/1253
set PATH=%PATH%;"D:\DevApps\PHP5.6.6"
IF "%LARAVEL%"=="1" (
SET LARAVEL=0
echo "End commit of PHP-CS-Fixer"
) ELSE (
SET LARAVEL=1
echo "PHP-CS-Fixer"
"D:\DevApps\PHP5.6.6\php.exe" "%~dp0php-cs-fixer.phar" --verbose fix --config-file=.php_cs
git add .
git commit -a --amend --no-verify
)
#!/bin/sh
#ToDo: move contents from batch file to here
BRANCH_NAME=$(git branch | grep '*' | sed 's/* //')
REBASING=$(echo $BRANCH_NAME | grep 'rebasing')
if [ -z "$REBASING" ];then
REBASING=$(echo $BRANCH_NAME | grep 'no branch')
fi
if [ -z "$REBASING" ];then
cmd.exe /c "D:\DevApps\Phar\gitlaravel.bat"
else
echo 'Rebasing: Ignoring post-commit hook.'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment