Skip to content

Note open source

All posts
Oct 30, 20267 min readopen source · Git · AI coding · developer toolsRead in:ENID

Git AI: Track Exactly Which Lines Your AI Coding Agent Wrote

Git AI is a Git extension that links every AI-generated line to the agent, model, and prompt behind it, using Git Notes and an open standard, with 2,912 GitHub stars under Apache-2.0.

Close-up of colorful code on a dark monitor screen.

When an AI coding agent writes half of a pull request, a simple question becomes surprisingly hard to answer: which lines did the human write, and which came from the machine? Git AI answers that question line by line. It is an open source Git extension that tracks AI-generated code in your repositories, linking every AI-written line to the agent, model, and prompt that generated it, so the intent behind the code is never lost.

Key Takeaways

  • Git AI is a Git extension, not a detector: agents report exactly which lines they wrote, so attribution is explicit rather than guessed.

  • It stores line-level attribution in Git Notes, linking each line to the agent, model, and session behind it.

  • Attribution survives squash, merge, rebase, stash, and cherry-pick, because Git AI re-analyzes the final state after each operation.

  • It works locally with no login, no Git hooks, and no wrapper around the Git binary, so normal Git commands stay fast.

  • It is Apache-2.0 licensed, written in Rust, and holds 2,912 stars and 327 forks on GitHub.

What Git AI actually is

Git AI describes itself as "a Git extension for tracking the AI-generated code in your repos." The repository, git-ai-project/git-ai, was created in July 2025, is written in Rust, and is licensed under Apache-2.0. As checked on October 30, 2026, it holds 2,912 stars and 327 forks.

The core idea is simple, and it is what separates Git AI from AI code detectors. It does not scan your code and guess whether a human or a model wrote it. Instead, coding agents call `git-ai checkpoint` whenever they write or modify files, and on commit, Git AI stores line-level attribution data in Git Notes. Every AI line is therefore linked to the agent, model, and session that created it. As the project puts it, you can see the intent, requirements, and architecture decisions behind your code, not just the final diff.

The Repomaniac signal for the project sums it up in one line: track AI code in Git with Git AI, with attribution that follows each line from prompt to production.

How it works, in practice

There is deliberately almost nothing new to learn. The project promises "just prompt and commit, no workflow changes." Install the extension once, and attribution is linked to commits automatically, whether you commit with the agent, the Git CLI, or your favorite Git client. No per-repo setup and no Git hooks are required.

Under the hood, the flow has three steps. First, the agent checkpoints the lines it writes. Second, on commit, Git AI writes that attribution into a Git Note attached to the commit, so you can inspect it with `git log --show-notes="ai"`. Third, when history is rewritten, Git AI moves and merges the attributions to match the final state of the code. That last step is the one that makes the tool practical: without it, every rebase or squash would destroy the attribution history, which is exactly when teams rewrite history most.

Two commands show the value immediately. `git ai blame` is a drop-in replacement for `git blame` that shows AI attribution per line, and it supports the standard `git blame` flags. A line written by Claude shows up as Claude, next to the human author and date of the surrounding code. And `git ai stats` aggregates the percentage of AI code across commits, including AI lines generated versus committed, acceptance rates, and a breakdown by tool and model, with a JSON output option for dashboards and CI.

Why explicit attribution beats detection

AI detectors try to answer the same question by guessing, and guessing has a ceiling. A detector can be wrong in both directions, flagging human code as AI-generated or missing machine-written code that a human lightly edited. Git AI sidesteps the problem entirely by recording the truth at creation time: the agent itself reports which lines it wrote.

That distinction matters more as AI-written code grows. For code review, a reviewer can see which hunks deserve extra scrutiny and which prompt produced them. For debugging, a strange block of code can be traced back to the session that generated it, instead of leaving the next developer to reverse-engineer the reasoning. For teams, the aggregate stats answer real management questions: how much AI code reaches production, which tools produce code that survives review, and how much rework AI code needs after deployment.

There is also a privacy design worth noting. Prompts are scanned and redacted, then saved outside of Git, keeping repositories lean and preventing secrets or personal data in prompts from leaking into the repo history. The attribution lives in Git Notes, while the sensitive session details stay under separate access control.

An open standard, not a walled garden

Git AI is built on an open standard for tracking AI-generated code with Git Notes, and the project lists support across the major coding agents: Claude Code, Codex, Cursor, GitHub Copilot, OpenCode, Pi, Windsurf, Droid, Amp, Gemini, Continue, Junie, Rovo Dev, and Firebender, with a documented route to add more. That breadth matters, because attribution is only useful if it survives tool changes. A standard stored in Git Notes means the data travels with the repository, not with one vendor's dashboard.

The editor story follows the same pattern. Community plugins show AI attribution in VS Code, Cursor, Windsurf, and Antigravity, color-coded by agent session in the gutter, with a hover to see the raw prompt or a summary. An Emacs magit integration exists too. The tool itself stays local-first and works offline with no login, while a separate Teams product adds organization-wide rollouts and aggregate insights across GitHub, GitLab, Bitbucket, or Azure DevOps.

How to try it

Installation is one command on Mac, Linux, and Windows (WSL):

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

Windows users can use the PowerShell installer from the project docs instead. After that, there is no per-repo setup: prompt, commit, and attribution follows automatically. If you want to see it working right away, run `git ai blame` on a file your agent recently touched, then `git ai stats` to see the AI percentage across your recent commits.

One honest caveat: Git AI only attributes code from agents that report it. If you paste AI-generated code by hand, or use an agent without Git AI support, those lines will not be attributed. The tool is accurate about what it records, but it cannot record what it never sees. Check the supported agent list before relying on the stats for a whole team.

Who should try it, and who can skip it

Try Git AI if you work with AI coding agents every day and want code review, debugging, or team metrics grounded in facts rather than guesses. Solo developers get the same benefit on a smaller scale: six months from now, you will be able to see exactly which prompt produced a confusing function, instead of wondering whether you wrote it at 2 a.m.

Skip it for now if you rarely use AI coding tools, or if your team has no reason to distinguish human from AI-written lines. The tool adds the most value exactly where AI code is already a large share of the codebase, and that is increasingly most codebases.

FAQ

Is Git AI free?

Yes. The core extension is free and open source under Apache-2.0, works locally, and requires no login or team setup. A separate Teams product exists for organization-wide analytics.

Does Git AI slow down Git?

No. It does not use Git hooks and does not wrap the Git binary, so Git operations run at their normal speed. Attribution is processed in a way that is eventually consistent after history rewrites, without adding latency to your commands.

How is this different from an AI code detector?

Detectors guess authorship from patterns in the code, which can be wrong. Git AI records authorship at creation time, because the agent reports exactly which lines it wrote. That makes the attribution explicit and auditable instead of probabilistic.

Does it work with my coding agent?

It supports Claude Code, Codex, Cursor, GitHub Copilot, OpenCode, and many others through its open standard, and the docs explain how to add support for a new agent. If your agent is not supported yet, its lines will not be attributed.

Watch the signal

Want the 30-second version? Watch the 30-second repo signal for Git AI on Repomaniac. If you are new to the open source world, start with What Is Open Source? What Open Source Means, in Plain English. Read this article in Indonesian: Git AI: Lacak Tepat Baris Mana yang Ditulis Agen Coding AI Anda.

*Sources: GitHub git-ai-project/git-ai README, Git AI docs: How Git AI Works, Git AI docs: AI Blame, Git AI docs: Stats command, Repomaniac signal, October 30, 2026. Star and fork counts verified on GitHub on October 30, 2026.*

Tags: open source · Git · AI coding · developer tools

All posts