AgentSkillsCN

git-cherry-pick-hotfix

通过 cherry-pick 在各分支间选择并应用最小化热修复提交的专业化工作流。当 Git 历史、分支管理、同步或恢复工作流是核心关注点时,可选用此流程;但请勿将其用于 CI 工作流设计或应用行为的实现。

SKILL.md
--- frontmatter
name: git-cherry-pick-hotfix
description: "Specialized workflow for selecting and applying minimal hotfix commits across branches via cherry-pick. Use when Git history, branching, synchronization, or recovery workflows are the core concern; do not use for CI workflow design or application behavior implementation."

Git Cherry Pick Hotfix

Trigger Boundary

  • Use when a fix from one branch must be ported to another without full merge.
  • Do not use for broad release synchronization; use git-pr-sync-workflow.
  • Do not use for feature migration involving many dependent commits.

Goal

Backport urgent fixes safely with minimal unrelated change propagation.

Shared Git Contract (Canonical)

  • Use ../git-branch-strategy/references/git-governance-contract.md as the single schema and gate source.
  • Track hotfix backports with GIT-CHP-* IDs.
  • Run machine validation: python3 ../git-branch-strategy/scripts/validate_git_contract.py --manifest <path/to/manifest.json>.

Inputs

  • Source fix commit hashes and dependency notes
  • Target branch release constraints
  • Verification scope for target environment

Outputs

  • GIT-CHP-* cherry-pick execution record
  • Dependency and risk annotation per picked commit
  • Target-branch verification checklist and result

Workflow

  1. Identify minimal commit set required for the fix.
  2. Validate hidden dependencies before cherry-pick.
  3. Apply commits in dependency-safe order.
  4. Resolve conflicts and verify target branch behavior.
  5. Record source-to-target mapping with security review evidence.

Quality Gates

  • Picked commits exclude unrelated feature changes.
  • Dependency assumptions are explicitly validated.
  • Target branch tests pass for impacted flows.
  • Security Reviewer approval is present for GIT-CHP-* artifacts.

Failure Handling

  • Stop when hotfix requires broad dependency migration.
  • Escalate when target branch behavior diverges from source assumptions.