alias p='git add *; git commit -m ""; git push'And shout out to Bud Swayze on https://kick.com/budswayze - mention my nu11y sent you for 50% off subs!
AI-powered git commit message enhancer using Claude Sonnet & GPT-5.4. Transform your simple commit messages into clear, emoji-enhanced, professional descriptions that anyone can understand.
npm install -g nullcommits# 1. Set your API key (Anthropic recommended, OpenAI also supported)
nullcommits config set-anthropic-key sk-ant-your-api-key-here
# OR: nullcommits config set-key sk-your-openai-key-here
# 2. (Optional) Create a customizable template
nullcommits init
# 3. Install the hook in your git repo
cd your-project
nullcommits install
# 4. Commit as usual - messages are automatically enhanced!
git commit -m "fix bug"Save your Anthropic API key to ~/.nullcommitsrc. When set, Claude Sonnet is used as the primary AI provider with automatic fallback to OpenAI if the Anthropic call fails:
nullcommits config set-anthropic-key sk-ant-your-api-key-hereSave your OpenAI API key to ~/.nullcommitsrc:
nullcommits config set-key sk-your-api-key-hereSet the maximum characters for diff collection (default: 128K). Supports K suffix:
# Set to 256,000 characters
nullcommits config set-diff-budget 256K
# Or use exact number
nullcommits config set-diff-budget 64000Show the current diff budget setting:
nullcommits config show-diff-budgetCreate a global template file at ~/.nullcommits.template that you can customize:
nullcommits initThis creates the template file and shows you its location along with available template variables. Edit this file to customize how your commit messages are generated.
Install the nullcommits hook in the current git repository:
cd your-project
nullcommits installRemove the nullcommits hook from the current git repository:
nullcommits uninstallnullcommits supports two AI providers. When both keys are configured, Claude Sonnet is used by default with automatic fallback to OpenAI if the Anthropic call fails.
Option A: CLI Command
nullcommits config set-anthropic-key sk-ant-your-api-key-hereOption B: Environment Variable
export ANTHROPIC_API_KEY="sk-ant-your-api-key-here"Option A: CLI Command
nullcommits config set-key sk-your-api-key-hereOption B: Environment Variable
export OPENAI_API_KEY="sk-your-api-key-here"Add environment variables to your ~/.bashrc, ~/.zshrc, or shell profile to make them permanent.
Config File (Manual)
Create/edit ~/.nullcommitsrc:
{
"anthropicApiKey": "sk-ant-your-api-key-here",
"apiKey": "sk-your-openai-key-here"
}nullcommits uses a template to instruct the AI how to generate commit messages. You can customize this at both global and local (per-project) levels!
Create a global template:
nullcommits initThis creates ~/.nullcommits.template which you can edit freely.
Create a local (project-specific) template:
cp ~/.nullcommits.template .nullcommits.templatePlace .nullcommits.template in the root of your repository for project-specific customization.
The template supports these variables that get replaced at runtime:
| Variable | Description |
|---|---|
{{ORIGINAL_MESSAGE}} |
The original commit message you provided |
{{DIFF}} |
The git diff of staged changes |
{{MULTI_LINE_INSTRUCTION}} |
Auto-injected when 10+ lines changed |
Templates are loaded in this order (highest priority first):
- Local template -
.nullcommits.templatein repository root - Global template -
~/.nullcommits.templatein home directory - Bundled default - Built into nullcommits package
This allows you to have a personal default template while overriding it for specific projects that need different formatting.
nullcommits uses intelligent diff collection to ensure large commits don't exceed API token limits. The diff budget (default: 128K characters) is divided equally among files, with unused budget redistributed to files that need more space.
Configure via CLI:
nullcommits config set-diff-budget 256KOr via environment variable:
export NULLCOMMITS_DIFF_BUDGET=256000Or in config file ~/.nullcommitsrc:
{
"apiKey": "sk-your-api-key-here",
"diffBudget": 256000
}- Media file handling: Binary files (images, videos, audio) show only filenames, not diff content
- Budget redistribution: Files with smaller diffs share their unused budget with larger files
- Multi-line commits: When 10+ lines are changed, the AI is instructed to create detailed multi-line commit messages
Supported media extensions (filename only, no diff):
- Images:
.png,.gif,.jpg,.jpeg,.webp,.svg,.ico,.bmp,.tiff,.tif,.avif - Video:
.mp4,.mov,.avi,.mkv,.webm,.wmv,.flv,.m4v - Audio:
.mp3,.wav,.ogg,.flac,.aac,.m4a,.wma
Once installed, just commit as usual:
git add .
git commit -m "fix bug"nullcommits will automatically enhance your commit message using Claude Sonnet (or GPT-5.4 as fallback). Your simple "fix bug" might become:
๐ Fix critical authentication bypass vulnerability
Resolved an issue where users could bypass login validation by submitting
empty credentials. Added proper null checks and improved error handling
to ensure all authentication attempts are properly validated.
- You run
git commit -m "your message" - Git triggers the
prepare-commit-msghook - nullcommits reads your message and the staged diff
- Claude Sonnet (or GPT-5.4 fallback) generates an enhanced message with:
- Relevant emoji
- Clear, descriptive summary
- Explanation of what changed and why
- The enhanced message replaces your original
- Commit completes seamlessly
To remove the hook from a repository:
nullcommits uninstallTo completely remove nullcommits:
npm uninstall -g nullcommits- Node.js 18.0.0 or higher
- Git
- Anthropic API key (recommended) and/or OpenAI API key
Set at least one API key:
- Run:
nullcommits config set-anthropic-key YOUR_KEY(recommended) - Or:
nullcommits config set-key YOUR_OPENAI_KEY - Or set
ANTHROPIC_API_KEY/OPENAI_API_KEYenvironment variable
Run nullcommits install from inside a git repository.
The hook is already active in this repository. No action needed!
- Verify your API key is valid
- Check you have sufficient API quota
- If Anthropic fails, nullcommits will automatically fall back to OpenAI (if configured)
| File | Purpose |
|---|---|
~/.nullcommitsrc |
Stores your API keys and diff budget (JSON format) |
~/.nullcommits.template |
Your global custom template (created by nullcommits init) |
.nullcommits.template |
Local project-specific template (in repo root) |
.git/hooks/prepare-commit-msg |
The installed hook (per-repository) |
| Variable | Description | Default |
|---|---|---|
ANTHROPIC_API_KEY |
Your Anthropic API key (preferred) | - |
OPENAI_API_KEY |
Your OpenAI API key (fallback) | - |
NULLCOMMITS_DIFF_BUDGET |
Max characters for diff | 128000 |
MIT
Contributions are welcome! Please feel free to submit a Pull Request.