第一份可审 diff:aider --message
聊天回复不是 diff。第一条写出可审改动的命令是 aider --message,退出后用 git show。
聊天回复不是可审的 diff。第一条写出 diff 的命令是 aider --message:官方示例改完 hello.js 就退出,并默认自动 commit。到 wbmeet 建房,把 git show 贴给同事看。
检索词是 Aider 在 git 仓库写出的第一份 diff。官方 scripting 页写明:--message 只做这一件事,把编辑应用到文件,然后退出,并关闭聊天模式。usage 页写:改动时会显示 diff,并 git commit 全部改动。
为什么聊天回复不算第一份 diff
Git 集成页写:Aider 在 git 仓库里最好用。没有仓库时,它会询问是否创建。每次编辑文件,都会用说明性的提交信息做一次 commit,方便回头看和撤销。所以可审的结果是这次提交,不是终端里的一段说明。
写出第一份可审 diff 的四步
- 1
用官方安装,不要停在 pip 猜测
已有 Python 3.8–3.13 时:
python -m pip install aider-install,再跑aider-install。它把 Aider 装进单独环境,需要时会再装一份 Python 3.12。macOS / Linux 也可curl -LsSf https://aider.chat/install.sh | sh。Windows PowerShell:powershell -ExecutionPolicy ByPass -c "irm https://aider.chat/install.ps1 | iex"。pip 直装只支持 Python 3.9–3.12,命令是python -m pip install -U --upgrade-strategy only-if-needed aider-chat。找不到命令就试python -m aider。 - 2
先 cd 进仓库,并看 git status
安装页的下一步是
cd /to/your/project。工作区不干净时,Aider 会先把已有未提交改动单独 commit,再改文件。那样git show看到的第一笔可能是你的旧改动。先git status,干净了再跑下面这条。 - 3
跑 aider --message,这是写出 diff 的命令
官方示例是
aider --message "make a script that prints hello" hello.js。安装页给模型的写法是aider --model sonnet --api-key anthropic=<key>(注释写 Claude 3.7 Sonnet),也可换成--model deepseek或--model o3-mini。只把要改的文件放在命令里。密钥用占位符,不要写进仓库。 - 4
退出后用 git show,不要等 /diff
--message会退出聊天,所以审查命令是git show。Aider 自己写的提交,会在 author 和 committer 名字后加(aider)。聊天还开着时,/diff才显示上一条消息以来的文件改动,/undo丢掉上一次 AI 改动。
# Official · aider.chat · read 2026-11-16
python -m pip install aider-install
aider-install
cd /to/your/project
git status
aider --model sonnet --api-key anthropic=<key> \
--message "make a script that prints hello" hello.js
git show不要把这几条当成同一份 diff
| 命令 | 它实际做了什么 | 第一份 diff 停在这吗 |
|---|---|---|
aider | 只打开会话 | 不停:还没有提交 |
aider --message | 改文件并退出 | 这是写出 diff 的命令 |
git show | 看自动提交 | 退出后用它审查 |
/diff | 上一条消息以来的改动 | 仅会话还开着时 |
--no-auto-commits | 改动留在工作区 | 改去看 git diff |
脏工作区会先交你的旧改动
Git 页写:编辑前先把已有未提交改动 commit。那种提交只在 committer 后加 (aider),author 仍是你。Aider 自己写的提交,author 和 committer 都会带 (aider)。
默认跳过 pre-commit
默认用 --no-verify 跳过钩子(--git-commit-verify=False)。钩子必须跑时加上 --git-commit-verify。提交说明由 weak model 按 Conventional Commits 生成,不是人工批准。
安装细节在另一篇
密钥、模型和更长的第一次任务见 Aider 安装笔记。usage 页要求只加入真正要改的文件。
官方 scripting:--message 做一件事,把编辑应用到文件,然后退出。Git 页:每次编辑都会带说明信息 commit。
这份 git show 要给人看时,wbmeet 首页建房,发房间号即可,不用另装会议客户端。步骤见 如何创建与加入房间。何时不必再开沉重会议 App。
还容易看错的地方
--message 结束后会留下 commit 吗?
默认会。scripting 页写 auto-commits 默认 True。加上 --no-auto-commits 时改动留在工作区,审查改用 git diff。
退出之后还能用 /diff 吗?
不能。--message 关闭聊天模式并退出。/diff 只在会话还开着时,显示上一条消息以来的文件改动。退出后用 git show。
目录里没有 git 会怎样?
Git 页写:它会询问是否创建仓库。--no-git 会完全停用 git,文档要求你自己做好备份。那样没有可审的 git diff。
第一笔 commit 一定是 Aider 写的代码吗?
不一定。工作区不干净时,它先提交你已有的改动。先 git status。Aider 撰写的提交,author 与 committer 都会带 (aider)。