git-ai README

The project's README from github.com/git-ai-project/git-ai. As one markdown file: README.md.

git-ai Discord

Git AI Logo

Git AI is an open source git extension that tracks the AI-generated code in your repositories. After installing the extension, every line of AI code is linked to the agent, model, and prompts that generated it — so you never lose the intent, requirements, and architecture decisions behind your code.

Just prompt and commit — no workflow changes:

git commit

[hooks-doctor 0afe44b2] wsl compat check
2 files changed, 81 insertions(+), 3 deletions(-)

you  ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ai
     6%                                  94%

git ai blame /src/log_fmt/authorship_log.rs

cb832b7 (Aidan Cunniffe      2025-12-13  133) pub fn execute_diff(
cb832b7 (Aidan Cunniffe      2025-12-13  134)     repo: &Repository,
cb832b7 (Aidan Cunniffe      2025-12-13  135)     spec: DiffSpec,
fe2c4c8 (Aidan Cunniffe      2025-12-02  136)     format: DiffFormat,
fe2c4c8 (Aidan Cunniffe      2025-12-02  137) ) -> Result<…> {
fe2c4c8 (claude              2025-12-02  138)     // Resolve commits
fe2c4c8 (claude              2025-12-02  139)     let (from, to) = match spec {
fe2c4c8 (claude              2025-12-02  140)         DiffSpec::TwoCommit(s, e) => {
fe2c4c8 (claude              2025-12-02  141)             let from = resolve(repo, &s)?;

Install

Mac, Linux, Windows (WSL)

curl -sSL https://usegitai.com/install.sh | bash

Windows

powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://usegitai.com/install.ps1 | iex"

No per-repo setup or git hooks required. Commit with the Agent, git, or your favorite git client. Attribution will be linked to commits automatically.

The Git AI standard is supported by:

Claude Code Codex Cursor GitHub Copilot OpenCode
Pi Windsurf Droid Amp Gemini
Continue Junie Rovo Dev Firebender + Add an Agent

Our Choices

Want to learn more?

Meet the maintainers

Documentation

Attribution Stats

Line-level AI-attribution let you track AI-code through the full SDLC. Track how much AI code gets accepted, committed, through code review, and into production — to identify which tools and practices work best.

git ai stats --json
git ai stats <start_sha>..<end_sha> --json

Calculates % AI-code, AI-lines generated vs committed, accepted rates, human overrides broken down by tool and model. Learn more: Stats command reference docs.

Example JSON output
{
  "human_additions": 28,
  "ai_additions": 76,
  "ai_accepted": 47,
  "git_diff_deleted_lines": 34,
  "git_diff_added_lines": 104,
  "tool_model_breakdown": {
    "claude_code/claude-sonnet-4-5-20250929": {
      "ai_additions": 76,
      "ai_accepted": 47
    }
  }
}

AI Blame

Git AI blame is a drop-in replacement for git blame that shows AI attribution for each line. It supports all standard git blame flags.

git ai blame /src/log_fmt/authorship_log.rs
cb832b7 (Aidan Cunniffe 2025-12-13 08:16:29 -0500  136)     format: DiffFormat,
cb832b7 (Aidan Cunniffe 2025-12-13 08:16:29 -0500  137) ) -> Result<String, GitAiError> {
fe2c4c8 (claude         2025-12-02 19:25:13 -0500  138)     // Resolve commits to get from/to SHAs
fe2c4c8 (claude         2025-12-02 19:25:13 -0500  139)     let (from_commit, to_commit) = match spec {
fe2c4c8 (claude         2025-12-02 19:25:13 -0500  140)         DiffSpec::TwoCommit(start, end) => {
Git AI VS Code extension showing color-coded AI blame in the gutter

There are community plugins that display AI-attribution in popular IDEs, color-coded by agent session. Hover over a line to see the raw prompt or summary.

Supported Editors


For teams and enterprises

Get early access

We built Git AI for Teams to make it easy to roll out Git AI across your organization. Just connect GitHub, GitLab, Bitbucket, or Azure DevOps and get aggregate insights across all your repositories, plus the full trace of every agent session—from prompt all the way to production.

Screenshot 2026-07-29 at 3 48 26 PM

FAQs

How does it work?

  1. Coding Agents call git-ai checkpoint whenever they write code or modify files with bash scripts.
  2. On commit, Git AI stores line-level attribution data in Git Notes, linking each line of AI-generated code to the agent, model, and session that created it. Run git log --show-notes="ai" to see them.
  3. Git AI moves and merges line-level attributions when you squash, merge, reset, rebase, stash, cherry-pick, etc. so your AI code is always accurately tracked.

Git AI does not use AI or heuristics to "detect" AI code — the Agents report exactly which lines they wrote, providing the most accurate, explicit attribution possible.

Does the agent have to commit for Git AI to attribute the code?

No. Git AI works no matter how you commit — your Git client, the Git CLI, and your own Git aliases are all supported.

Git AI notes are attached to commits — how are attributions preserved when I rebase, squash, stash, cherry-pick, etc.?

Git AI analyzes the final state of the code after the operation completes and copies/merges the attributions into a Git Note for any updated commits. The entire system is eventually consistent and does not add latency to git operations.

Can I use this on my own?

Yes. Git AI is free and open source, works locally, and requires no login or team setup.

Is there a performance impact?

No. Git AI does not use Git hooks and it does not wrap Git, so you won't see any overhead on your Git commands.

Do I have to set up agent hooks?

Nope — Git AI manages the agent hooks and checks/updates them daily. If you want to trigger this yourself (ie just installed a new agent) run git ai install-hooks.

Who uses this?

Hundreds of engineering teams (including many in the Fortune 100) use Git AI to understand their AI usage and make agents more effective on their codebase.

What's the difference between the open source CLI and the teams version?

The CLI accurately attributes AI code on every commit. The teams version adds a secure prompt store and joins in data from across the SDLC — tying token spend to individual Pull Requests, calculating % AI by PR, team, and repo, and connecting signals like amount of rework during code review, and even tying incidents back to the AI session that caused them. Self-host it or run it in our cloud: connect your SCM and get aggregate stats across thousands of repos plus full observability into everything your coding agents do.

Who built this?

Aidan and Sasha — say hi in Discord or set up a Meet the maintainers call.

What are the capabilities and known limitations?

Git AI provides line-level attribution for AI-generated code - whether it is written with an edit tool or a bash command. When a Git rewrite operation is run (rebase, stash, squash --merge, etc) Git AI will move and merge attributions so nothing is lost.

Here is a full breakdown of what is supported today:

Capability Status Notes
Edit / Write / Patch tools ✅ Line-level attribution recorded automatically.
Files created via Bash ✅ May not work if the agent is not operating from the repository root.
Git worktrees ✅ Attribution maintained across linked worktrees.
Background Agents ✅ See docs for Claude Web, Codex Cloud, Cursor Agent, and Devin.
Attribute lines from multiple Agent Sessions in the same commit ✅
Record which lines a human overrode ✅
Attribute sessions that produced no code ✅ Records token usage and session activity even when no code is accepted.
Accepted rate per session ✅
Added and deleted lines per session ✅
Tool-call level attribution ✅ Resolves attributed lines to the tool call that generated them.
Tokens and cost per commit and PR ✅ Aggregates token usage and cost across the sessions behind each commit/PR.
Formatters ✅ Formatting will not change attribution to human.
Multi-repo root ⚠️ If you run an agent that edits multiple repos, Bash attributions only work when the agent runs each command with its cwd inside that repo.

Git Rewrite Operations:

Operation Status Notes
git rebase ✅ Attribution preserved. View Code
git cherry-pick ✅ Attribution preserved. View Code
git stash / git stash pop ✅ Attribution preserved. View Code
git merge --squash ✅ Attribution preserved. View Code
git reset --soft ✅ Attribution preserved. View Code
git reset --mixed ✅ Attribution preserved. View Code
git reset --hard ✅ Attribution preserved for commits that remain in history. View Code
git merge (merge commit) ✅ Attribution preserved. View Code
git commit --amend ✅ Attribution preserved, including unstaged and partially staged changes. View Code
git checkout / git switch (branches) ✅ Attribution follows the working tree across branch changes. View Code
git pull (fast-forward / --rebase) ✅ Attribution preserved, including autostashed changes. View Code
git push / git fetch ✅ Attribution notes synced to/from the remote. View Code
git mv ❌ Renames are not yet tracked; attribution does not follow the moved file.
git filter-branch / git filter-repo ❌ Bulk history rewrites are not tracked.
git replace ❌ Object replacements are not tracked.

GitHub, GitLab, Bitbucket, Azure DevOps:

Capability Status Notes
Squash and Merge ✅ Requires Git AI for Teams or Open Source CI Actions to preserve attribution.
Rebase and Merge ✅ Requires Git AI for Teams or Open Source CI Actions to preserve attribution.

License

Apache 2.0

git-ai (git-ai-project/git-ai)

Searching Database…

2.8K ·GitHub
Что это?Git AI — расширение для git, которое отслеживает сгенерированный AI код в ваших репозиториях, привязывая каждую написанную AI строку к агенту, модели и промпту, которые её породили.
Это замена обычному git или он работает рядом с ним?Он работает рядом с вашим обычным git-процессом, не заменяя git и не требуя хуков — вы просто промптите и коммитите как обычно, а Git AI автоматически прикрепляет метаданные атрибуции.
Как его установить и запустить?Установите бинарник Git AI на Mac, Linux или Windows (через WSL); настройка на уровне репозитория или git-хуки вручную не нужны, и после установки атрибуция начинает привязываться к коммитам автоматически.
Нужно ли самому настраивать хуки агентов?Нет — Git AI сам управляет хуками агентов и ежедневно проверяет/обновляет их; при желании можно запустить вручную через `git ai install-hooks`, если вы только что установили нового агента.
Какие git-операции он пока отслеживает некорректно?Переименование файлов через `git mv`, массовые перезаписи истории через `git filter-branch`/`filter-repo` и `git replace` сейчас не отслеживаются, поэтому в этих случаях атрибуция может теряться.
Для работы нужен интернет или вход в аккаунт?Нет — Git AI работает по принципу local-first, полностью офлайн и не требует входа.
Что происходит с моими промптами и данными сессий?Промпт-сессии сканируются и очищаются от чувствительных данных, а затем хранятся вне самого Git: репозитории остаются лёгкими, доступ можно тонко разграничивать, а утечка персональных данных или секретов предотвращается.
В чём разница между open source CLI и Git AI for Teams?CLI бесплатно и локально проставляет атрибуцию AI-кода в каждом коммите. Версия Teams добавляет защищённое хранилище промптов плюс агрегированную статистику по репозиториям, PR и контрибьюторам, привязывая расходы токенов и инциденты к конкретным AI-сессиям.
Как Git AI понимает, какие строки написаны AI — он угадывает?Он ничего не распознаёт и не угадывает — кодинг-агенты явно вызывают `git ai checkpoint` всякий раз, когда пишут или меняют код, так что атрибуция приходит напрямую от агента, сообщающего о своих правках.
Какие редакторы могут показывать AI-атрибуцию прямо в коде?Плагины сообщества показывают раскрашенную по цветам AI-атрибуцию в VS Code, Cursor, Windsurf, Antigravity и Emacs magit — наведите курсор на строку, чтобы увидеть исходный промпт или сводку.
Атрибуция переживает rebase, squash или stash?Да — после таких операций, как rebase, squash, stash, cherry-pick и reset, Git AI заново анализирует итоговое состояние кода и переносит атрибуции в обновлённые коммиты, не замедляя git-операции.
What are similar projects?Baize, worktrunk, lean-ctx, weave, graphicle, codex, agentplay, emdash
Size
89 MB
Stars
2.8K
Age
1y
Commits · 90 Days