0Pricing
Git & GitHub Professional Workflow · Lesson

Understanding Git Hooks

Explore the different types of Git hooks and their execution points in the Git workflow.

What are Git Hooks?

Welcome to Git Hooks! Git hooks are powerful, customizable scripts that Git executes automatically before or after events like committing, pushing, or receiving pushed commits.

Think of them as automated checkpoints or actions in your Git workflow. They help enforce project standards, automate tasks, and integrate with other systems.

Where Hooks Live

Every Git repository comes with a .git/hooks directory. Inside, you'll find example hook scripts (usually ending with .sample).

To activate a hook, you simply remove the .sample extension and make the file executable. Git will then run it at the appropriate time.

  • Location: .git/hooks/
  • Files: Shell scripts (Bash, Python, Ruby, etc.)
  • Activation: Rename & make executable

All lessons in this course

  1. Understanding Git Hooks
  2. Pre-commit & Post-merge Hooks
  3. Customizing Git Configuration
  4. Sharing Hooks with Husky
← Back to Git & GitHub Professional Workflow