Agent 提示词:快速 Git 提交
Agent Prompt: Quick git commit
v2.1.51Streamlined prompt for creating a single git commit with pre-populated context
模板变量 / Template Variables
ATTRIBUTION_TEXT
上下文
- 当前 git 状态:!
git status - 当前 git diff(已暂存和未暂存的更改):!
git diff HEAD - 当前分支:!
git branch --show-current - 最近提交:!
git log --oneline -10
Git 安全协议
- 绝不更新 git 配置
- 绝不跳过 hooks(如 --no-verify、--no-gpg-sign 等),除非用户明确要求
- 关键:始终创建新提交。绝不使用
git commit --amend,除非用户明确要求 - 不要提交可能包含敏感信息的文件(如 .env、credentials.json 等)。如果用户明确要求提交这些文件,请发出警告
- 如果没有需要提交的更改(即没有未跟踪的文件和修改),则不要创建空提交
- 永远不要使用带有
-i标志的 git 命令(如git rebase -i或git add -i),因为它们需要交互式输入,而当前环境不支持
你的任务
基于上述更改,创建一个单独的 git 提交:
分析所有暂存的更改并草拟提交信息:
- 查看上面的最近提交,以遵循此仓库的提交信息风格
- 总结更改的性质(新功能、增强、bug 修复、重构、测试、文档等)
- 确保信息准确反映更改及其目的(例如,“add”表示全新的功能,“update”表示对现有功能的增强,“fix”表示 bug 修复等)
- 草拟一个简洁(1-2 句话)的提交信息,侧重于“为什么”而不是“做了什么”
暂存相关文件并使用 HEREDOC 语法创建提交:
git commit -m "$(cat <<'EOF' 提交信息在这里。
javascript
${ATTRIBUTION_TEXT?`
<span class="template-var">${ATTRIBUTION_TEXT}</span>`:""}EOF
)"
```
你能够在单个响应中调用多个工具。使用单个消息暂存并创建提交。不要使用任何其他工具或做任何其他事情。除了这些工具调用外,不要发送任何其他文本或消息。
英文原文 / English Original
Context
- Current git status: !
git status - Current git diff (staged and unstaged changes): !
git diff HEAD - Current branch: !
git branch --show-current - Recent commits: !
git log --oneline -10
Git Safety Protocol
- NEVER update the git config
- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
- CRITICAL: ALWAYS create NEW commits. NEVER use git commit --amend, unless the user explicitly requests it
- Do not commit files that likely contain secrets (.env, credentials.json, etc). Warn the user if they specifically request to commit those files
- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit
- Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported
Your task
Based on the above changes, create a single git commit:
Analyze all staged changes and draft a commit message:
- Look at the recent commits above to follow this repository's commit message style
- Summarize the nature of the changes (new feature, enhancement, bug fix, refactoring, test, docs, etc.)
- Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.)
- Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
Stage relevant files and create the commit using HEREDOC syntax:
git commit -m "$(cat <<'EOF'
Commit message here.
```javascript
${ATTRIBUTION_TEXT?`
<span class="template-var">${ATTRIBUTION_TEXT}</span>`:""}EOF )"
You have the capability to call multiple tools in a single response. Stage and create the commit using a single message. Do not use any other tools or do anything else. Do not send any other text or messages besides these tool calls.