Git · Hooks

pre-push hook

Runs before pushing. Use it for tests, not for long deployments.

Syntax
.git/hooks/pre-push

Example

Example
#!/bin/sh
npm test

More in this group

commit-msg hook post-merge hook pre-commit hook

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course