git-ai
https://github.com/git-ai-project/git-ai
bash
git tag latest
git tag -d latest
git push origin latest #推送单个标签
git push origin --tags #推送所有标签
git push origin <branch_name> --tags #推送标签和分支
git push origin --delete <tag_name> 删除远程标签
git tag #列出本地标签
git ls-remote --tags origin #列出远程标签bash
git tag -d latest && \
git tag latest && \
git push origin latest -f命令
git命令相关
CAUTION
在 Git 中,git pull 默认不会拉取 notes(笔记)信息,这是因为 notes 存储在特殊的引用(refs/notes/*)中,而不是普通的分支引用。默认情况下,git pull 只会同步分支的引用,而不会同步 refs/notes/*。
bash
$ git log --show-notes=ai
$ git notes --ref=ai show fccd431a02517f2071193d8c3e247cf214a581cc
---
{
"schema_version": "authorship/3.0.0",
"git_ai_version": "1.1.11",
"base_commit_sha": "fccd431a02517f2071193d8c3e247cf214a581cc",
"prompts": {}
}
$ git --no-pager notes --ref=ai show fccd431a02517f2071193d8c3e247cf214a581cc
$ git notes --ref=ai show 67ce0efb0442be5206c51d292c3409b7944c2e0b
error: no note found for object 67ce0efb0442be5206c51d292c3409b7944c2e0b.安装
Mac, Linux, Windows (WSL)
bash
$ export GIT_AI_LOCAL_BINARY=/Volumes/macdata/download/git-ai-macos-x64
$ curl -sSL https://usegitai.com/install.sh | bash
Using local git-ai binary (release: local)...
Created symlink at /Users/jade/.local/bin/git-ai
Successfully installed git-ai into /Users/jade/.git-ai/bin
You can now run 'git-ai' from your terminal
Installed git-ai 1.1.8
Setting up IDE/agent hooks...
Coding Agents
✓ Claude Code: Hooks updated
✓ Cursor: Hooks updated
⚠ Cursor: Unable to automatically install extension. Please cmd+click on the following link to install: cursor:extension/git-ai.git-ai-vscode (or search for 'git-ai-vscode' in the Cursor extensions tab)
✓ VS Code: Hooks already up to date
Installing extensions...
Installing extension 'git-ai.git-ai-vscode'...
Extension 'git-ai.git-ai-vscode' v0.1.17 was successfully installed.
✓ VS Code: Extension installed
✓ VS Code: git.path updated in /Users/jade/Library/Application Support/Code/User/settings.json
✓ VS Code: chat hook settings updated in /Users/jade/Library/Application Support/Code/User/settings.json
✓ GitHub Copilot: Hooks updated
✓ IntelliJ IDEA Ultimate: Plugin installed from JetBrains Marketplace
✓ Rider: Plugin installed from JetBrains Marketplace
Git Clients
Successfully set up IDE/agent hooks
Updated shell configurations:
✓ /Users/jade/.bash_profile
✓ /Users/jade/.zshrc
✓ /Users/jade/.config/fish/config.fish
To apply changes immediately:
- For bash: source /Users/jade/.bash_profile
- For zsh: source /Users/jade/.zshrc
- For fish: source /Users/jade/.config/fish/config.fish
Close and reopen your terminal and IDE sessions to use git-ai.Windows (non-WSL)
powershell -NoProfile -ExecutionPolicy Bypass -Command "irm http://usegitai.com/install.ps1 | iex"插件 https://marketplace.visualstudio.com/items?itemName=git-ai.git-ai-vscode
配置
应用配置
在 Linux 和 macOS 上,该文件位于 $HOME/.git-ai/config.json。在 Windows 上,该文件位于 %USERPROFILE%\.git-ai\config.json 。
bash
$ git-ai config set telemetry_oss off #关闭发送给 Git AI 维护者的 OSS 性能指标和错误日志 telemetry_oss_disabled
$ git-ai config set prompt_storage notes #默认是存local sqlite,改为存储在notes中插件配置
- Gitai: Enable Checkpoint Logging
- Gitai › Experiments: Ai Tab Tracking
命令
当前工作变更中 AI 与人类创作的视觉摘要。
git-ai statusdiff
行级作者归属
git-ai blame path/to/file 是 git blame 的替换,包含每行的 AI 作者归属。
git-ai blame
git-ai blame <file>
git-ai blame <file> --json --contents [stdin]Commit(提交) 统计
bash
$ git-ai stats --json #显示最近一次commit的统计数据
$ git-ai stats 4b825dc642cb6eb9a060e54bf8d69288fbee4904..HEAD #左不包含,右包含checkpoint
# Basic checkpoint with preset claude\cursor\github-copilot\mock_ai
git-ai checkpoint <preset>
# Show the current working log
git-ai checkpoint --show-working-log
# Reset the working log
git-ai checkpoint --reset- Git AI 检查点追踪提交开始到结束之间的增量代码变化。每个检查点包含当前状态与上一个检查点之间的差异,标记为 AI 或人工编写。这些检查点是临时的,存储在
.git/ai中,直到提交完成。 - 像 Cursor、Claude Code 和 GitHub Copilot 这样的编码代理,在修改时调用 Git AI 来标记其更改为 AI 创作。任何支持钩子的代理都可以与 Git AI 合作。
- Git AI 需要两个钩子:一个在代理编辑代码之前,一个在之后。预编辑检查点确保自上次代理编辑以来的任何人工更改都被标记为人工创作。编辑后检查点则会选取新插入的 AI 代码并标记为 AI 编写。
- 作者日志通过提交 SHA 处理,应视为不可变。
提交后,每个作者日志通过 git 备注附加到新提交上。
http://10.177.11.188:9000/ai-registry/git-ai/v1.1.8/git-ai-macos-x64
http://10.177.11.188:9000/maven-registry/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar{"human_additions":151,"mixed_additions":0,"ai_additions":0,"ai_accepted":0,"total_ai_additions":0,"total_ai_deletions":0,"time_waiting_for_ai":0,"git_diff_deleted_lines":4,"git_diff_added_lines":151,"tool_model_breakdown":{}}{
"human_additions": 82,
"mixed_additions": 0,
"ai_additions": 2,
"ai_accepted": 2,
"total_ai_additions": 2,
"total_ai_deletions": 2,
"time_waiting_for_ai": 0,
"git_diff_deleted_lines": 84,
"git_diff_added_lines": 84,
"tool_model_breakdown": {
"github-copilot::unknown": {
"ai_additions": 2,
"mixed_additions": 0,
"ai_accepted": 2,
"total_ai_additions": 2,
"total_ai_deletions": 2,
"time_waiting_for_ai": 0
}
}
}{
"human_additions": 151,
"mixed_additions": 0,
"ai_additions": 0,
"ai_accepted": 0,
"total_ai_additions": 0,
"total_ai_deletions": 0,
"time_waiting_for_ai": 0,
"git_diff_deleted_lines": 4,
"git_diff_added_lines": 151,
"tool_model_breakdown": {}
}- copilot生成后,关闭vscode,重新打开后选择变动,归属human
- Idea 中的Github Copilot不支持
- 不要使用