Overview of iGit AI-Powered Commit Messages
iGit is a tool that automatically generates commit messages following the Conventional Commits specification to ensure a clear and professional commit history.
website·Indexed 31 days ago
https://igit.erguotou.meAn AI-powered tool for generating commit messages that follow conventional commits. Features include an AI commit generator, Git hooks integration, and configuration via .config/igit.yaml.
# Generate a commit message and wait for user confirmation
igit commit
# Generate a commit message and commit immediately without confirmation
igit commit -y
# Generate the message only (dry-run) without performing the git commit
igit commit -d.config/igit.yaml file, which includes schema hints for easier editing.# 1. Install the CLI
npm install @doremijs/igit-cli
# 2. Initialize iGit configuration
npx igit init
# 3. Install Git Hooks
npx igit installiGit hooks behave as follows:
--skip-install flag..config/igit.yaml. You can generate a default configuration file automatically by running the igit init command.igit initTo ensure the AI generates accurate and high-quality commit messages, follow these best practices:
# Correct workflow: stage specific files then commit
git add <files>
igit commitcommit_msg configuration options. Available options include enabling validation, defining a list of valid commit types, and automatically prepending emojis to messages.commit_msg:
enabled: true
validTypes: ["feat", "fix", "docs"]
prependEmoji: truestaged_hooks to run specific commands based on file patterns. File matching is handled by fast-glob (Rust ecosystem). Define patterns as keys in the rules object and provide a list of commands to run against matching files.staged_hooks:
enabled: true
rules:
"**/*.{js,ts}":
- eslint --fix
- prettier --write
"**/*.{css,less,scss}":
- stylelint --fixstaged_hooks:
enabled: true
rules:
"**/*.{js,ts}":
- eslint --fix
"**/*.{css,scss}":
- stylelint --fix.config/igit.yaml file before execution.git add .
npx igit commit -ystaged_hooks for fast linting/formatting of changed files and pre-push hooks for heavier tasks like test coverage and production builds.hooks:
enabled: true
hooks:
pre-push:
- npm run test:coverage
- npm run build
staged_hooks:
enabled: true
rules:
'**/*.{css,scss,less,styl,stylus}': stylelint --fix
'**/*.{js,jsx,ts,tsx}': biome check --writeai section. To secure your API key, it is recommended to use the OPENAI_API_KEY environment variable instead of writing the key directly in the igit.yaml file, or ensure the config file is excluded from git version control.ai:
enabled: true
baseUrl: https://api.openai.com
apiKey: your-api-key # Use OPENAI_API_KEY env var instead
model: gpt-3.5-turbo
respondIn: English