Usage
Usage
Learn how to use Git-AIC to generate commit messages using global commands or local project scripts.
Running Git-AIC
1. Global Commands
If installed globally, stage your files and run:
git aic
Options:
- Automatic Push: Commit and push directly to your remote:
git aic --push - Link GitHub Issue: Reference an issue in your commit message:
git aic --issue 42
2. Project-Level Scripts (npm/pnpm)
If you prefer to keep the CLI scoped to a specific project and shared with your team, you can configure it locally as a development dependency.
Step 1: Install as a Development Dependency
Run the installation command for your package manager:
Using npm:
npm install --save-dev git-aic
Using pnpm:
pnpm add --save-dev git-aic
Step 2: Configure your package.json
Add a custom script mapping to the scripts object in your project’s package.json file:
{
"scripts": {
"commit": "git-aic"
}
}
Step 3: Run the Commit Command
Once configured, you can run the local script:
Using npm:
npm run commit
Using pnpm:
pnpm commit
Interactive Confirmation Flow
Once invoked, Git-AIC reads your staged diff and generates a proposed message:
- Accept (
y): Accept the message and finalize the commit. - Reject/Abort (
n): Cancel the operation safely. - Retry (
r): Regenerate the message. - Edit (
e): Open the message in your terminal editor (e.g., Vim/Nano) to make manual edits before committing.