Git commit and push

From TencentBlueKing/bk-ci · View interactive version

Git commit and push is an AI agent skill from the GitHub repository TencentBlueKing/bk-ci. 通过 BK-CI 仓库约定安全执行本地提交与远端推送,例如根据当前变更生成一句简短提交内容、先展示给用户确认、确认后再 `git commit`,并默认推送到个人 fork 远端而不是主仓库。 当用户要求“帮我 commit / push / 提交并推送代码 / 发到远端”时优先使用。

How to use this skill

Skill file

Git 提交与推送

适用场景

不适用场景

快速指导

  1. 先看分支和工作树状态,再决定能否提交:
  1. push 前先识别远端角色,不要假设 origin 一定是 fork:
  1. 当前在 master、main、release-* 等共享分支时,不要默认直接推送;优先提醒用户改走 github-worktree 或明确确认风险。
  2. commit 前先整理提交边界:只提交与本次需求直接相关的文件;遇到无关改动、敏感文件或可疑生成物,先停下来和用户确认。
  3. 先基于当前变更生成一条简短预览文案,默认格式为:
  1. 若分支能解析出 issue 号,且已知 issue 标题,可直接复用 issue 标题作为前半句;后半句根据当前 diff 补一句简单说明。
  2. 示例:
  1. 特例: 如果用户明确指定了某个 issue,并明确说“直接推送”,则把这视为对 commit + push 的一次性授权:
  1. 默认路径下,把生成的预览内容先展示给用户,等待用户明确回复“没问题”“可以提交”“直接 push”等确认后,再执行 git commit 和 git push。
  2. commit message 的格式、type 选择、Issue 号拼接规则,复用 git-commit-specification;本 skill 只补“基于当前 diff 生成一句摘要并先确认”这层工作流,以及“指定 issue + 直接推送”的快捷特例。
  3. commit 成功后再判断 push 策略,默认目标是 fork 远端:
  1. push 完成后,向用户反馈实际结果:当前分支、推送到的 fork remote、是否已建立 upstream、是否还需要走 PR 流程。

高信号规则

关键陷阱

延伸阅读

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.