第一份可審 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)。