git-push
GitHub在用户请求推送或发布分支时,安全地将已提交的代码推送到正确的远程分支。包含状态检查、保护分支拒绝、脏工作区处理及推送拒绝后的分歧检查与询问逻辑。
Trigger Scenarios
Install
npx skills add Terry-Mao/AICodingFlow --skill git-push -g -y
SKILL.md
Frontmatter
{
"name": "git-push",
"description": "Push committed branch work to the correct remote branch with minimal checks and no unsafe force pushes."
}
git-push
Use after commits exist and the user asks to push or publish the branch.
Inspect
Use one tool call for push state:
git status --short
git branch --show-current
git rev-parse --abbrev-ref --symbolic-full-name @{u}
git log --oneline @{u}..HEAD
If upstream lookup fails, prepare git push -u origin <branch> and use recent local commits only when the commit set is unclear.
Push
- Refuse protected/shared base branches (
main,master,develop, release branches) unless explicitly asked. - Dirty worktree changes are not pushed; report them and continue only when pushing existing commits is still clearly intended.
- Use normal push so hooks run:
git push
git push -u origin <branch>
Rejections
If push is rejected, then fetch and inspect divergence. Ask before rebasing, merging, or using git push --force-with-lease. Never use plain git push --force unless the user explicitly requests that exact behavior.
Report current branch, upstream/remote branch, pushed commit hash, push result, and dirty changes that were not pushed.
Version History
- e53c5ac Current 2026-07-24 11:35


