LaravelTips and TricksTipsTesting
February 15, 2024
How to use git hooks to run scripts before the committing code to repo
By Vladimir Nikolic

February 15, 2024
By Vladimir Nikolic

here iw how.
In root, run this:
touch .git/hooks/pre-commit
Then, make it executable:
chmod +x .git/hooks/pre-commit
#!/bin/sh
echo "Running Pint ... "
files=$(git diff --cached --name-only --diff-filter=ACM -- '*.php');
./vendor/bin/pint $files
git add $files
echo "Running Pest ..." ./vendor/bin/pest --parallel --processes=4
and that is all.
Tell us about the codebase and where it runs. We will tell you what we would do first.
Contact Us