Post-update Hooks

Learn about post-update hooks for server-side Git operations

Post-update Hooks

Post-update hooks run on the server after refs are updated, commonly used for deployment and notifications.

Use Cases

  • Deploy applications
  • Send notifications
  • Update documentation
  • Trigger CI/CD pipelines

Example Hook

#!/bin/bash
# .git/hooks/post-update

# Deploy to production
if [[ $1 == refs/heads/main ]]; then
    echo "Deploying to production..."
    ./deploy.sh
fi