From 50a90b70bc513712e141488e29bc5a75b3c10514 Mon Sep 17 00:00:00 2001 From: John Guo Date: Fri, 23 Jan 2026 14:26:24 +0800 Subject: [PATCH] Update .github/prompts/gf.commit-push.prompt.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/prompts/gf.commit-push.prompt.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/prompts/gf.commit-push.prompt.md b/.github/prompts/gf.commit-push.prompt.md index 3dbb2a905..8d2358dfb 100644 --- a/.github/prompts/gf.commit-push.prompt.md +++ b/.github/prompts/gf.commit-push.prompt.md @@ -74,14 +74,22 @@ test(container/garray): add unit tests for sorted array 按照以下顺序执行 git 操作: -1. **git add -A** - - 将所有修改的文件添加到暂存区 +1. **检查待提交文件** + - 使用 `git status` 和 `git diff` 确认本次需要提交的变更 + - 排除调试、临时或生成文件,以及可能包含敏感信息的文件 -2. **git commit -m "commit message"** +2. **选择性暂存变更** + - 使用 `git add ...` 按文件添加需要提交的修改 + - 或使用 `git add -p` 进行交互式暂存,确保只加入相关修改 + +3. **检查已暂存内容** + - 使用 `git diff --cached` 检查暂存区的变更是否符合预期 + +4. **git commit -m "commit message"** - 使用生成的 commit message 提交代码 - 确保 commit message 符合上述规范 -3. **git push** +5. **git push** - 将本地提交推送到远程仓库 - 如果是首次推送新分支,使用 `git push -u origin `