The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Practical Git: Run scripts on git events with git hooks

Practical Git: Run scripts on git events with git hooks

2:58
Git lets us run scripts on git events like `pre-commit`, `pre-rebase`, `post-commit`, `post-merge`, `post-checkout`, etc. You can do this by adding an executable file to the `./git/hooks` directory which has a name matching the git hook name. In this lesson, we walk through this process by setting up a `pre-commit` hook which runs our `npm test` and `npm run lint` npm scripts to ensure we don't have any failing tests or lint errors before committing.
Watch this lesson now
Avatar
egghead.io

Git lets us run scripts on git events like pre-commit, pre-rebase, post-commit, post-merge, post-checkout, etc. You can do this by adding an executable file to the ./git/hooks directory which has a name matching the git hook name. In this lesson, we walk through this process by setting up a pre-commit hook which runs our npm test and npm run lint npm scripts to ensure we don't have any failing tests or lint errors before committing.

Avatar
Meysam

Great tip! I did not know this

In reply to egghead.io
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?