Write a commit message for what you staged, not everything you edited
说明与用途
自动化流程,生成仅包含已暂存更改的提交信息,避免误导性描述。
问题
When only part of a file is staged, a commit message that describes all edits in the file misrepresents the commit content.
结果
The workflow demonstrates how to generate a commit message that accurately reflects only staged changes, preventing misleading commit descriptions.
工作流
- Clone the agent-toolbox repo and switch to demo branch
- Append a new test to test/todo.test.js
- Stage the file with git add
- Rename an existing test in the same file without staging
- Verify status shows MM and diff shows staged vs unstaged changes
- Prompt the assistant with the Good Commit skill to generate a commit message
- Review the proposed message to ensure it matches git diff --cached
- Copy the Good Commit skill into your own repo and use the same prompt
- Optionally contribute improvements via issues
证据
Suppose you add a todo validation test and also tidy another test in the same file. You stage only the new test. A commit message describing both edits would promise a change that is not in the commit.
The assistant should explain that this proposal covers the staged test addition and mention the unstaged test-name edit separately.
- 记录日期: 2026-10-15T21:41:11.580Z