Git AIC is a TypeScript CLI for two related workflows inside a Git repository:
- generating AI-assisted conventional commit messages from staged changes
- generating AI-explained markdown diff reports from selected working-tree changes
It is built for local Git usage with interactive file selection, Gemini-based summarization, and a low-friction terminal UX.
git aic
- inspects the repository for changed files
- auto-stages deleted files for commit workflows
- lets you choose which files should be part of the commit when there are multiple changed files
- stages newly selected files and unstages deselected staged files
- sends the staged diff to Gemini
- generates a Conventional Commits style message
- commits with that message
git aic --push / git aic -p
- runs the same commit flow
- pushes after a successful commit
git aic --diff / git aic -d
- inspects the repository for changed files
- lets you choose which files should be included in the report when there are multiple changed files
- does not stage or unstage files for the diff workflow
- reads the selected changes directly from the working tree
- generates a markdown report in
git-diffs/ - explains each selected file diff with AI
- includes current repo metadata such as branch and base commit hash
- Conventional commit generation: Commit messages are guided by strict prompt rules.
- Single logical change stays one line: If multiple files all belong to one logical change, the generated commit message stays a one-line summary.
- Unrelated changes may become a list: If the changes are clearly unrelated, the generated commit message may use a summary line plus bullet points.
- Interactive file selection: Multi-file changes open a selector so the user can choose the exact file set to commit, push, or document.
- AI diff reports: Diff reports explain the selected changes before showing the raw patch.
- Structured diff naming: Report filenames use a concise
type-topic.mdformat such asfeat-auth-flow.md. - Organized output: Reports are written to
git-diffs/in the current working directory. - Git ignore support: On the first diff report run that creates
git-diffs/, the tool addsgit-diffs/to the current directory’s.gitignoreif it is not already ignored. - Visible loading states: Uses
cli-loaderswith thearrows_3loader and step-specific status messages. - Retry-safe AI requests: Retries temporary Gemini rate limits and transient failures, then falls back cleanly if needed.
Each generated markdown report includes:
- report title
- metadata section
- generated timestamp
- current branch
- short base commit hash
- full base commit hash
- selected file list
- one section per file
- AI explanation above the raw diff block
The easiest way to use Git AIC is to install it globally via npm or bun:
npm install -g @amnesia2k/git-aic
# or
bun install -g @amnesia2k/git-aicOnce installed, you can skip the manual setup and use the built-in configuration commands:
git-aic set-key your_gemini_api_key_heregit-aic alias
For developers or users who want to run the tool from the source code:
- Clone the repository:
git clone https://github.com/amnesia2k/git-aic.git
cd git-aic- Install dependencies:
bun install- (Optional) Link the package locally:
npm linkGit AIC requires a Google Gemini API key.
You can securely store your API key in your user profile:
git-aic set-key your_gemini_api_key_hereTo see your current configuration:
git-aic showAlternatively, you can set the GEMINI_COMMIT_MESSAGE_API_KEY variable.
Windows PowerShell:
setx GEMINI_COMMIT_MESSAGE_API_KEY "your_gemini_api_key_here"MacOS & Linux:
export GEMINI_COMMIT_MESSAGE_API_KEY=your_gemini_api_key_hereRestart the terminal after setting the variable.
To use the tool as a native Git subcommand (git aic), you need to set up a Git alias.
If you installed via NPM, run:
git-aic aliasIf you are running from a local clone, point the alias to your entry point:
Windows PowerShell:
git config --global alias.aic '!npx tsx "C:/Users/YourName/path/to/git-aic/bin/cli.ts"'macOS / Linux:
git config --global alias.aic '!npx tsx "/Users/YourName/path/to/git-aic/bin/cli.ts"'Generate and create a commit:
git aicGenerate, commit, and push:
git aic --pushGenerate a markdown diff report:
git aic --diffShow current configuration:
git aic showDisplay help:
git aic helpTip
Use git aic help or git aic -h to see the help menu. Git reserves --help for its own internal documentation search, which causes raw --help to fail on custom aliases.
Also supported:
git aic -d : This is a shortcut for `git aic --diff`
git aic -p : This is a shortcut for `git aic --push`Commit workflows are based on the staged diff.
When you select files for commit mode:
- unselected staged files are unstaged
- selected unstaged files are staged
- the final commit message is generated from the resulting staged diff
Diff report workflows are based on the selected changes directly.
When you select files for -d / --diff:
- the tool does not stage files
- the tool does not unstage files
- the tool reads the selected diffs and generates the markdown report from them
This keeps the report flow non-destructive and avoids changing index state unnecessarily.
Example generated report paths:
git-diffs/feat-auth-flow.mdgit-diffs/fix-config-loading.mdgit-diffs/refactor-cli-loader.md
If a filename already exists, numeric suffixes are used:
feat-auth-flow.mdfeat-auth-flow-1.mdfeat-auth-flow-2.md
This project is licensed under the MIT License. See the file for details.
Developed by a passionate software engineer.
- Olatilewa Olatoye
- LinkedIn:
[Olatilewa Olatoye] - X (formerly Twitter):
[@olathedev_]