Aider 是一款终端 AI 结对编程工具,可直接在本地代码库中完成代码修改并自动生成 Git 提交。Documentation Index
Fetch the complete documentation index at: https://docs.rixapi.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
安装
配置与启动
方式一:环境变量(推荐,永久生效)
Mac / Linux (zsh)
Mac / Linux (zsh)
Mac / Linux (bash)
Mac / Linux (bash)
Windows (PowerShell)
Windows (PowerShell)
方式二:命令行参数(单次使用)
使用 Anthropic 模型
使用 .aider.conf.yml 配置文件
在项目根目录创建 .aider.conf.yml,避免每次手动传参:
常用命令
启动后,在 Aider 交互界面中可使用以下命令:| 命令 | 说明 |
|---|---|
/add <文件> | 将文件加入当前编辑上下文 |
/drop <文件> | 从上下文中移除文件 |
/diff | 查看当前会话产生的所有代码变更 |
/undo | 撤销最近一次 AI 做出的 Git 提交 |
/commit | 提交当前变更 |
/model <模型名> | 切换模型 |
/exit | 退出 Aider |
推荐模型
| 场景 | 推荐模型 |
|---|---|
| 通用编程 | gpt-4o |
| 复杂重构 | claude-opus-4-5-20251101 |
| 快速迭代 | gpt-4o-mini |
Aider 默认会将所有修改自动提交到 Git,建议在干净的 Git 状态下使用,方便通过
/undo 回滚。