AgentSkillsCN

managing-git-workflow

通过上下文感知的消息与工单提取功能,自动完成Git提交、推送与PR创建。在执行Git操作、创建提交/PR,或当用户提及Git、GitHub、提交、推送或拉取请求时使用。

SKILL.md
--- frontmatter
name: managing-git-workflow
description: Automates git commits, push, and PR creation with context-aware messages and ticket extraction. Use when performing git operations, creating commits/PRs, or when user mentions git, GitHub, commit, push, or pull request.
allowed-tools: "Bash(git:*) Bash(gh:*)"

Managing Git Workflow

Overview

Automates git workflows for commit, push, and PR creation with context-aware message generation and automatic ticket number extraction.

When to Use

  • Creating commits with auto-generated messages in project's language
  • Pushing changes (with automatic commit if needed)
  • Creating PRs (with automatic push and commit if needed)
  • When user mentions: git, commit, push, pull request, PR, GitHub

Workflow Selection

TaskReference DocumentAuto-includes
Commit onlymanaging-git-workflow/reference/commit.md-
Push to remotemanaging-git-workflow/reference/push.mdCommit (if uncommitted changes)
Create PRmanaging-git-workflow/reference/pr.mdPush + Commit (if needed)

Common Principles

Commit Messages:

  • Use language specified in project context, prompts, or documentation (default to English if unspecified)
  • Follow existing project patterns (analyze with git log --online -10)
  • Include ticket numbers (FMT-XXXXX, FLEASVR-XXX, etc.) if found in branch name or changes

Branch Naming:

  • Extract ticket numbers from branch names for PR titles
  • Use descriptive, concrete names

All commands start with git or gh to ensure compatibility with standard permission patterns (Bash(git:*), Bash(gh:*)).

Quick Reference

bash
# Check status
git status --porcelain                    # empty = clean
git rev-list --count @{u}..HEAD           # 0 = up to date
git branch --show-current                 # current branch name
gh pr list --head "$(git branch --show-current)" --json number --jq 'length'  # 0 = no PR

Implementation

For commit workflow: See managing-git-workflow/reference/commit.md

For push workflow: See managing-git-workflow/reference/push.md

For PR workflow: See managing-git-workflow/reference/pr.md

Each reference document provides step-by-step instructions for that specific operation.