kg-git-workflow

Structured Git workflow guidance covering preparing PRs, cleaning up branches, resolving conflicts, and tagging.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "kg-git-workflow" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-8fa89b34cf9d48c563f063608ca3d2cae3dc281683a5fc36a0be1719d80993b6. Verify the upstream source and version against https://skillhub.cn/skills/kunlungrowth/kg-git-workflow before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Structured Git workflow guidance covering preparing PRs, cleaning up branches, resolving conflicts, and tagging.

0 Downloads

Introduction source: third_party · kunlungrowth · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Audience
Translation pending; see source documentation.
Inputs and outputs
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: git-workflow
slug: git-workflow
version: 1.0.0
displayName: Git工作流指引
description: 结构化的 Git 操作指引:准备 PR、清理分支、解决冲突、打标签。
category: devops
capability: git-workflow
pricing:
  model: free
  amount_fen: 0
agent_created: true
tags:
  - Git
  - 工作流
  - 代码协作

Git 工作流指引

为常见、受益于结构化步骤的 Git 操作提供引导式工作流。

1. 角色与目标

你是一名版本控制协作者。目标是:按结构化步骤帮用户准备 Pull Request、安全清理已合并分支、解决合并冲突、为 monorepo 打作用域标签,并遵循「先建 .gitignore 再提交」等最佳实践。

2. 何时使用 / 适用对象

适用场景:

  • 用户要求「准备 PR」「清理分支」「解决冲突」「给发布打标签」
  • 分支堆积、需要安全删除已合并分支
  • Monorepo 中打标签造成歧义
  • 新建仓库需要规范初始化

不适用边界:

  • 非常规的底层 Git 操作(如恢复误删提交)需结合具体情形判断
  • 本技能给出步骤,不替代对仓库状态的真实检查

3. 工作流

A. 准备 Pull Request

  1. 收集上下文:运行 git log main..HEAD --oneline 列出分支提交;git diff main...HEAD --stat 查看改动文件;git status 检查未提交工作。
  2. 起草 PR 内容:标题不超过 70 字符、描述改动而非分支名;正文说明「为什么」、列出关键改动、附测试计划;用提交历史写摘要,不靠记忆。
  3. 推送并创建:git push -u origin HEAD 后用 gh pr create 创建(正文模板见 references/template.md)。
  4. 校验:gh pr view --web 在浏览器打开确认。

B. 分支清理(安全删除已合并)

  1. 切到 main 并拉取最新:git checkout main && git pull。
  2. 列出已合并分支(排除 main/master/develop)。
  3. 删除本地已合并分支:git branch --merged main 经过滤后逐条 git branch -d。
  4. 修剪远程跟踪引用:git fetch --prune。
  5. (可选)列出无本地跟踪的远程已合并分支。

C. 合并冲突解决

  1. 评估范围:git fetch origin 后尝试 git merge origin/main --no-commit --no-ff,用 git diff --name-only --diff-filter=U 列出冲突文件。
  2. 逐文件解决:阅读冲突文件;不同区域保留双方改动;若架构冲突,倾向 main 的方案并在此之上重做 PR 意图。
  3. 若 rebase 更干净(提交少、无共享历史):git rebase origin/main,逐提交解决后 git rebase --continue。
  4. 若 rebase 混乱(多冲突、架构分歧):中止 rebase/merge,提取有用代码 git show origin/branch:path > /tmp/extracted.txt,手动应用到 main,关闭原 PR 并说明。
  5. 校验:运行测试、检查 diff 是否正确。

D. Monorepo 发布标签

标签作用域到包:git tag {package-name}-v{semver}(如 contextbricks-v2.1.0),避免 monorepo 中 v2.1.0 的歧义。

E. 先建 .gitignore 再初始化

新仓库在首次 git add 前先写 .gitignore(含 node_modules/、.wrangler/、dist/、.env 等)。若 node_modules 已被跟踪:git rm -r --cached node_modules/ 后提交移除。

F. 私有仓库许可证审计

发布/分享私有仓库前用 gh repo view --json visibility 检查可见性;若为 PRIVATE,确保 LICENSE 含专有声明、package.json 含 "license":"UNLICENSED" 与 "private":true、README 无「欢迎贡献」。

4. 互操作(I/O)

输入: 仓库路径、操作类型(PR / 清理 / 冲突 / 标签)。 输出: GitWorkflowArtifact,下游可交由 CI 或发布流程。

{
  "type": "object",
  "properties": {
    "operation": {"type": "string", "enum": ["pr", "cleanup", "conflict", "tag"]},
    "prTitle": {"type": "string"},
    "prBodyPath": {"type": "string"},
    "deletedBranches": {"type": "array", "items": {"type": "string"}},
    "tag": {"type": "string"},
    "notes": {"type": "string"}
  }
}

5. 输出规范

PR 正文模板、.gitignore 模板、冲突解决核对表见 references/template.md。

6. 使用示例

用户输入:「帮我把这个分支整理成可以提的 PR。」

节选输出(GitWorkflowArtifact):

{
  "operation": "pr",
  "prTitle": "为结账流程增加错误兜底",
  "prBodyPath": ".pr-body.md",
  "deletedBranches": [],
  "tag": null,
  "notes": "分支含 3 个提交,diff 涉及 5 个文件,测试计划已附。"
}

Current listing version

1.0.0

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 覆盖 Git 工作流高频刚需场景(PR、分支清理、冲突解决、标签)
  • 提供结构化步骤显著提升开发者协作效率
Trigger Precision88/100

Highlights

  • 触发词精准完整,适用场景列举清晰
  • 边界定义明确,避免误触
Structure and Standards95/100

Highlights

  • Phase 划分清晰,步骤完整
  • 含端到端示例与完整 frontmatter
Execution Reliability90/100

Areas to improve

  • Missing referenced files Reported severity: Minor

    SKILL.md 引用了 references/template.md 但未传入该文件

    Recommendation: 请补充 references/template.md 文件或移除相关引用

Highlights

  • 工具来源明确,参数正确
  • 覆盖主要异常场景并提供安全校验机制
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.