Git hooks are just scripts executed when you execute an action, such as commit. They can contain any programming language.
An example of running grunt:
#!/bin/sh grunt
Save this in a file: .git/hooks/pre-commit
If grunt fails with an error code above 0, which occurs when any task fails, this prevents the adoption:
Exiting non-zero from this hook cancels commit
Reading Material: Tips for Using git pre-commit hook
And git docs: 8.3 Configuring Git - Git Hooks
Like many other version control systems, Git has a way to run user scripts when performing certain important actions.
Sindre sorhus
source share