Git Hooks Generator

Generate Git hook scripts for automation

Runs before a commit is created

githooks.preventLargeFilesMB

githooks.install.title

  1. githooks.install.step1
  2. githooks.install.step2
  3. githooks.install.step3

Git Hooks Guide

What are Git Hooks?

Git hooks are scripts that Git executes before or after events such as commit, push, and merge. They allow you to automate tasks and enforce policies in your development workflow.

Hook Types

pre-commit

Runs before commit. Use for linting, formatting, and validation.

commit-msg

Validates commit message format (e.g., Conventional Commits).

pre-push

Runs before push. Use for tests and branch protection.

post-merge

Runs after merge. Use for auto npm install on package changes.

Manual Installation

# Navigate to hooks directory

cd .git/hooks

# Create hook file

touch pre-commit

# Make executable

chmod +x pre-commit

Using Husky (Recommended)

# Install husky

npm install husky --save-dev

# Initialize husky

npx husky init

# Add pre-commit hook

echo "npm run lint" > .husky/pre-commit

Related Tools

Developer Tools

開発者向けの80以上の無料オンラインツールを提供します。Base64、JSON、JWT、正規表現など必須ツールを一か所で。

クイックリンク

Developer Tools © 2025. All rights reserved.

ほとんどのツールはブラウザ内で動作し、ネットワークが必要なツールのみ実行時にデータを送信します。

Git Hooks Generator - Pre-commit, Pre-push Scripts | Developer Tools