feat: add --amend option for commit command#13
Merged
zccrs merged 2 commits intozccrs:masterfrom Oct 11, 2025
Merged
Conversation
1. Added --amend flag to modify the last commit instead of creating a new one 2. Implemented logic to fetch diff from last commit when in amend mode 3. Added display of original commit message for reference during amend 4. Modified git command execution to include --amend flag when appropriate 5. Added proper error handling for amend mode when no commit history exists 6. Updated help documentation to include the new --amend option 7. Skip AI code review for amend operations since it's modifying existing commit Log: Added --amend option to modify last commit with new commit message Influence: 1. Test normal commit functionality to ensure no regression 2. Test --amend option with staged changes to modify last commit 3. Test --amend option with other flags like --only-chinese 4. Verify error handling when no commit history exists for amend 5. Test amend with different commit types and messages 6. Verify that original commit message is displayed correctly 7. Ensure AI code review is skipped for amend operations feat: 为 commit 命令添加 --amend 选项 1. 添加 --amend 标志用于修改上一次提交而不是创建新提交 2. 实现在 amend 模式下从上次提交获取差异内容的逻辑 3. 添加在 amend 时显示原提交信息供参考的功能 4. 修改 git 命令执行以在适当时包含 --amend 标志 5. 为 amend 模式添加适当的错误处理,当没有提交历史时 6. 更新帮助文档以包含新的 --amend 选项 7. 为 amend 操作跳过 AI 代码审查,因为是修改现有提交 Log: 新增 --amend 选项用于使用新提交信息修改上次提交 Influence: 1. 测试正常提交功能以确保没有回归 2. 测试 --amend 选项与暂存更改一起使用来修改上次提交 3. 测试 --amend 选项与其他标志如 --only-chinese 的组合使用 4. 验证当没有提交历史时 amend 的错误处理 5. 测试使用不同提交类型和消息的 amend 操作 6. 验证原提交信息是否正确显示 7. 确保 AI 代码审查在 amend 操作中被跳过
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds an --amend option to the commit command, allowing users to modify the last commit instead of creating a new one. The feature includes proper diff handling from the previous commit, displays the original commit message for reference, and skips AI code review for amend operations.
- Added
--amendflag parameter to commit command structure and function signatures - Implemented logic to fetch diff from last commit when in amend mode with proper error handling
- Modified commit execution to include
--amendflag and updated user prompts for amend context
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main.rs | Added amend parameter to commit command definition and function call |
| src/git.rs | Added helper functions to get last commit diff and message for amend mode |
| src/commit.rs | Implemented amend logic with conditional diff handling, UI updates, and git command modification |
| README.md | Updated documentation to include the new --amend option and usage examples |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
zccrs
approved these changes
Oct 11, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
zccrs
approved these changes
Oct 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Log: Added --amend option to modify last commit with new commit message
Influence:
feat: 为 commit 命令添加 --amend 选项
Log: 新增 --amend 选项用于使用新提交信息修改上次提交
Influence: