auto-push
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCommit and Push Everything
提交并推送所有更改
⚠️ CAUTION: Stage ALL changes, commit, and push to remote. Use only when confident all changes belong together.
⚠️ 注意:暂存所有更改、创建提交并推送到远程仓库。仅当确认所有更改属于同一批次时再使用此操作。
Workflow
工作流程
1. Analyze Changes
1. 分析更改
Run in parallel:
- - Show modified/added/deleted/untracked files
git status - - Show change statistics
git diff --stat - - Show recent commit for message style
git log -1 --oneline
并行运行以下命令:
- - 显示已修改、已添加、已删除和未跟踪的文件
git status - - 显示更改统计信息
git diff --stat - - 显示最近一次提交以参考提交信息风格
git log -1 --oneline
2. Safety Checks
2. 安全检查
❌ STOP and WARN if detected:
- Secrets: ,
.env*,*.key,*.pem,credentials.json,secrets.yaml,id_rsa,*.p12,*.pfx*.cer - API Keys: Any ,
*_API_KEY,*_SECRETvariables with real values (not placeholders like*_TOKEN,your-api-key,xxx)placeholder - Large files: without Git LFS
>10MB - Build artifacts: ,
node_modules/,dist/,build/,__pycache__/,*.pyc.venv/ - Temp files: ,
.DS_Store,thumbs.db,*.swp*.tmp
API Key Validation:
Check modified files for patterns like:
bash
OPENAI_API_KEY=sk-proj-xxxxx # ❌ Real key detected!
AWS_SECRET_KEY=AKIA... # ❌ Real key detected!
STRIPE_API_KEY=sk_live_... # ❌ Real key detected!❌ 若检测到以下内容,立即停止并发出警告:
- 密钥文件:,
.env*,*.key,*.pem,credentials.json,secrets.yaml,id_rsa,*.p12,*.pfx*.cer - API密钥:任何带有真实值的,
*_API_KEY,*_SECRET变量(不包括*_TOKEN、your-api-key、xxx这类占位符)placeholder - 大文件:未使用Git LFS且大小>10MB的文件
- 构建产物:,
node_modules/,dist/,build/,__pycache__/,*.pyc.venv/ - 临时文件:,
.DS_Store,thumbs.db,*.swp*.tmp
API密钥验证规则:
检查已修改文件中的以下模式:
bash
OPENAI_API_KEY=sk-proj-xxxxx # ❌ 检测到真实密钥!
AWS_SECRET_KEY=AKIA... # ❌ 检测到真实密钥!
STRIPE_API_KEY=sk_live_... # ❌ 检测到真实密钥!✅ Acceptable placeholders:
✅ 可接受的占位符:
API_KEY=your-api-key-here
SECRET_KEY=placeholder
TOKEN=xxx
API_KEY=<your-key>
SECRET=${YOUR_SECRET}
**✅ Verify:**
- `.gitignore` properly configured
- No merge conflicts
- Correct branch (warn if main/master)
- API keys are placeholders onlyAPI_KEY=your-api-key-here
SECRET_KEY=placeholder
TOKEN=xxx
API_KEY=<your-key>
SECRET=${YOUR_SECRET}
**✅ 需验证:**
- `.gitignore`配置正确
- 无合并冲突
- 当前分支正确(若为main/master分支则发出警告)
- API密钥仅为占位符3. Request Confirmation
3. 请求用户确认
Present summary:
📊 Changes Summary:
- X files modified, Y added, Z deleted
- Total: +AAA insertions, -BBB deletions
🔒 Safety: ✅ No secrets | ✅ No large files | ⚠️ [warnings]
🌿 Branch: [name] → origin/[name]
I will: git add . → commit → push
Type 'yes' to proceed or 'no' to cancel.WAIT for explicit "yes" before proceeding.
展示如下摘要信息:
📊 更改摘要:
- X个文件已修改,Y个文件已添加,Z个文件已删除
- 总计:+AAA行插入,-BBB行删除
🔒 安全检查:✅ 未检测到密钥 | ✅ 无大文件 | ⚠️ [警告信息]
🌿 分支:[分支名称] → origin/[分支名称]
我将执行:git add . → 提交 → 推送
请输入「yes」继续,或「no」取消。必须等待用户输入明确的「yes」后再执行后续操作。
4. Execute (After Confirmation)
4. 执行(确认后)
Run sequentially:
bash
git add .
git status # Verify staging按顺序运行以下命令:
bash
git add .
git status # 验证暂存状态5. Generate Commit Message
5. 生成提交信息
Analyze changes and create conventional commit:
Format:
[type]: Brief summary (max 72 characters)
- Key change 1
- Key change 2
- Key change 3Types: , , , , , , , , ,
featfixdocsstylerefactortestchoreperfbuildciExample:
docs: Update concept README files with comprehensive documentation
- Add architecture diagrams and tables
- Include practical examples
- Expand best practices sections分析更改内容并生成符合规范的提交信息:
格式:
[type]: 简短摘要(最多72个字符)
- 关键更改1
- 关键更改2
- 关键更改3类型选项: , , , , , , , , ,
featfixdocsstylerefactortestchoreperfbuildci示例:
docs: 更新概念类README文件,补充完整文档
- 添加架构图和表格
- 包含实用示例
- 扩展最佳实践章节6. Commit and Push
6. 提交并推送
bash
git commit -m "$(cat <<'EOF'
[Generated commit message]
EOF
)"
git push # If fails: git pull --rebase && git push
git log -1 --oneline --decorate # Verifybash
git commit -m "$(cat <<'EOF'
[生成的提交信息]
EOF
)"
git push # 若失败则执行:git pull --rebase && git push
git log -1 --oneline --decorate # 验证提交结果7. Confirm Success
7. 确认操作成功
✅ Successfully pushed to remote!
Commit: [hash] [message]
Branch: [branch] → origin/[branch]
Files changed: X (+insertions, -deletions)✅ 已成功推送到远程仓库!
提交:[哈希值] [提交信息]
分支:[分支名称] → origin/[分支名称]
更改文件数:X(+插入行数,-删除行数)Error Handling
错误处理
- git add fails: Check permissions, locked files, verify repo initialized
- git commit fails: Fix pre-commit hooks, check git config (user.name/email)
- git push fails:
- Non-fast-forward:
git pull --rebase && git push - No remote branch:
git push -u origin [branch] - Protected branch: Use PR workflow instead
- Non-fast-forward:
- git add 执行失败:检查权限、锁定文件,验证仓库是否已初始化
- git commit 执行失败:修复提交前钩子问题,检查git配置(user.name/email)
- git push 执行失败:
- 非快进式更新:执行
git pull --rebase && git push - 远程分支不存在:执行
git push -u origin [分支名称] - 受保护分支:改用PR工作流
- 非快进式更新:执行
Alternatives
替代方案
If user wants control, suggest:
- Selective staging: Review/stage specific files
- Interactive staging: for patch selection
git add -p - PR workflow: Create branch → push → PR (use command)
/pr
⚠️ Remember: Always review changes before pushing. When in doubt, use individual git commands for more control.
如果用户希望自主控制,建议使用:
- 选择性暂存:查看/暂存特定文件
- 交互式暂存:使用进行补丁式选择
git add -p - PR工作流:创建分支 → 推送 → 发起PR(使用命令)
/pr
⚠️ 提醒:推送前务必检查所有更改。如有疑问,使用单独的Git命令以获得更多控制权。