Skip to content
ZhymabekRomanPublic

About

Global Git hook to automatically strip AI model mentions and Co-Authored-By tags from commits.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Global Git Hooks

This repository contains a global Git hook configuration to enforce clean commit histories by stripping unwanted metadata generated by AI assistants and CLI tools (like Claude Code, GitHub Copilot, Cursor, etc.).

Features

  • Removes Co-Authored-By tags injected automatically by AI tools.
  • Strips AI Model Mentions: Automatically removes case-insensitive references to AI models like Claude, GPT, Gemini, Llama, Mistral, DeepSeek, Qwen, etc.
  • Cleans Trailing Whitespace: Ensures commit messages are compact and properly formatted without excessive trailing newlines.
  • Preserves Standard Git Trailers: Keeps valid Git trailers like Reviewed-by: and Tested-by:.
  • E2E Test Coverage: Comes with a robust test suite to verify the hook against various commit shapes and synthetic scenarios.

Installation

To apply this hook globally across all your local Git repositories:

  1. Clone this repository:

    git clone https://github.com/zhymabekroman/git-hooks.git ~/SOFT/git-hooks
  2. Make the hook executable:

    chmod +x ~/SOFT/git-hooks/prepare-commit-msg
  3. Set the global Git core.hooksPath:

    git config --global core.hooksPath ~/SOFT/git-hooks

Note: If a repository has a local hooksPath set (e.g., git config --local core.hooksPath .git/hooks), it will override this global setting. To remove a local override, run git config --local --unset core.hooksPath inside that repository.

Testing

You can run the end-to-end tests to ensure the hook behaves as expected across different edge cases:

bash test_git_hook.sh

Supported Filters

The hook currently filters mentions of the following tools and models: Claude, Opus, Sonnet, Haiku, GPT, ChatGPT, Gemini, Copilot, Anthropic, OpenAI, Llama, Mistral, DeepSeek, Qwen, Phind, Cursor, Tabnine, Cody, Grok.

About

Global Git hook to automatically strip AI model mentions and Co-Authored-By tags from commits.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages