返回 Skill 列表
extension
分类: 开发与工程无需 API Key

push-changes

将git更改推送到远程仓库,包括状态检查、暂存、提交和推送的完整工作流程。当用户要求推送更改、上传代码或与远程同步时使用。包括安全检查以防止直接推送到主分支。

person作者: jakexiaohubgithub

Push Changes

Push local changes to the remote repository with safety checks.

Workflow

  1. Check current branch

    git branch --show-current
    

    STOP if on main or master: Warn the user they forgot to create a branch. ALWAYS use the AskQuestion tool:

    • Title: "Branch Required"
    • Question: "You're currently on the main branch. What branch name would you like to use?"
    • Options:
      • id: "custom", label: "Let me specify a branch name"
      • id: "abort", label: "Abort, I'll create it myself"

    If the user selects "custom", ask them conversationally for the branch name, then create and switch to it:

    git checkout -b <branch-name>
    
  2. Check status

    git status
    

    Review untracked files and modifications.

  3. Stage changes

    git add -A
    

    Or selectively add specific files if the user prefers.

  4. Review staged changes

    git diff --staged --stat
    
  5. Commit with descriptive message Analyze the changes and create a commit message following conventional commits format:

    git commit -m "$(cat <<'EOF'
    <type>(<scope>): <description>
    
    <optional body>
    EOF
    )"
    

    Types: feat, fix, docs, style, refactor, test, chore

  6. Push to remote

    git push -u origin HEAD
    
  7. Verify push succeeded

    git status
    

    Confirm the branch is up to date with remote.

Safety Rules

  • Never push to main or master - always create a feature branch first
  • Never force push unless explicitly requested by the user
  • Review changes before committing to avoid committing secrets or unwanted files