![Forrest logo](/images/logo.png)
grumphp:tldr:2a1ab
The command grumphp git:pre-commit
is used to execute the pre-commit hook provided by GrumPHP for a Git repository.
GrumPHP is a PHP task runner which can be integrated into your Git workflow. It helps automate code quality assurance tasks by running various checks and tests before allowing a commit to be made. The pre-commit hook is a script that runs before a commit is finalized, allowing you to halt the commit process if certain conditions are not met.
When you run grumphp git:pre-commit
command, GrumPHP will trigger the pre-commit hook configured for the current Git repository. The hook will then run the defined tasks, such as linting, checking coding standards, running unit tests, etc. These tasks are configured in the grumphp.yml
file in the repository.
If any of the defined tasks fail, GrumPHP will halt the commit process and display the error messages. This helps ensure that your code meets the required quality standards before it is committed to the repository.
Using grumphp git:pre-commit
command manually allows you to test the pre-commit hook and the associated tasks without actually committing any changes. It's often used during development or debugging to ensure that the configured checks are working as expected.