custom-skills-git-commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGit Commit Custom Skill
Git Commit Custom Skill
此 Skill 提供 Git 提交工作流的模組化功能,供 指令調用。
git-commitThis Skill provides modular functions for Git commit workflows, to be invoked by the command.
git-commit模組清單
Module List
| 模組 | 檔案 | 說明 |
|---|---|---|
| 共用工具 | | 主分支判斷(main/master)、衝突處理、提交規範 |
| 同步 | | Stash、Rebase/Merge、Stash Pop |
| 分析 | | 定義基準點、檢查變更 |
| 提交 | | Normal/Final 模式提交 |
| 推送 | | 推送至遠端、處理分叉 |
| 合併 | | 多分支整合測試 |
| PR | | 建立 Pull Request 流程 |
| PR 分析 | | PR 專用的變更分析與摘要生成 |
| Module | File | Description |
|---|---|---|
| Shared Utilities | | Main branch detection (main/master), conflict handling, commit conventions |
| Sync | | Stash, Rebase/Merge, Stash Pop |
| Analyze | | Define baseline, check changes |
| Commit | | Normal/Final mode commit |
| Push | | Push to remote, handle divergence |
| Merge | | Multi-branch integration testing |
| PR | | Pull Request creation workflow |
| PR Analyze | | PR-specific change analysis and summary generation |
使用方式
Usage
此 Skill 由 指令調用,不應直接使用。
git-commit調用時,根據路由邏輯讀取對應的模組檔案:
This Skill is invoked by the command, should not be used directly.
git-commitWhen invoked, the corresponding module file is read and executed according to routing logic:
前置準備(必須)
Prerequisites (Mandatory)
- 讀取 :取得主分支名稱判斷與共用函式
_utils.md
- Read : Obtain main branch name detection and shared functions
_utils.md
路由邏輯
Routing Logic
IF pr 子指令:
→ 讀取並執行 `pr.md`(內部調用 `pr-analyze.md`)
→ 結束
IF merge 子指令:
→ 讀取並執行 `merge.md`
→ 結束
IF 當前分支為主分支 (main/master):
IF --direct:
→ 跳過同步,直接執行分析與提交
ELSE:
→ 警告:「⚠️ 目前在主分支上,建議切換至開發分支。若要直接提交,請使用 --direct 參數。」
→ 中止流程
ELSE (開發分支):
1. 讀取並執行 `sync.md` — 環境同步
2. 讀取並執行 `analyze.md` — 變更分析
3. 讀取並執行 `commit.md` — 執行提交
4. IF --push:
→ 讀取並執行 `push.md` — 推送至遠端IF pr subcommand:
→ Read and execute `pr.md` (internally calls `pr-analyze.md`)
→ Exit
IF merge subcommand:
→ Read and execute `merge.md`
→ Exit
IF current branch is main branch (main/master):
IF --direct:
→ Skip sync, directly execute analysis and commit
ELSE:
→ Warning: "⚠️ Currently on main branch, it is recommended to switch to a development branch. To commit directly, use the --direct parameter."
→ Abort process
ELSE (development branch):
1. Read and execute `sync.md` — Environment sync
2. Read and execute `analyze.md` — Change analysis
3. Read and execute `commit.md` — Execute commit
4. IF --push:
→ Read and execute `push.md` — Push to remotepr 模式路由
PR Mode Routing
當使用 時:
git-commit pr1. 讀取 `_utils.md` — 取得主分支名稱
2. 讀取並執行 `pr.md` — PR 主流程
├─ 前置檢查(分支、gh CLI)
├─ 範圍判定
├─ 讀取並執行 `pr-analyze.md` — 變更分析與摘要生成
├─ ⚠️ 檢查現有 PR(必須在 squash 前執行)
│ ├─ 若 MERGED/CLOSED → 繼續建立新 PR
│ └─ 若 OPEN → 詢問使用者:更新現有 PR / 建立新分支+新 PR / 中止
├─ 提交整理(除非 --no-squash)
├─ 推送
└─ 建立 PR(預設草稿,--direct 為正式)⚠️ 重要:PR 檢查必須在 squash 之前執行。 若分支已有 OPEN 的 PR,squash 會覆蓋該 PR 的所有提交。 未經使用者確認就執行 squash 可能導致不可逆的問題。
When using :
git-commit pr1. Read `_utils.md` — Obtain main branch name
2. Read and execute `pr.md` — PR main workflow
├─ Pre-checks (branch, gh CLI)
├─ Scope determination
├─ Read and execute `pr-analyze.md` — Change analysis and summary generation
├─ ⚠️ Check existing PR (must be executed before squash)
│ ├─ If MERGED/CLOSED → Continue creating new PR
│ └─ If OPEN → Ask user: Update existing PR / Create new branch + new PR / Abort
├─ Commit cleanup (unless --no-squash)
├─ Push
└─ Create PR (draft by default, formal with --direct)⚠️ Important: PR check must be executed before squash. If there is an OPEN PR for the branch, squash will overwrite all commits of that PR. Executing squash without user confirmation may cause irreversible issues.
--direct 模式路由
--direct Mode Routing
當使用 在主分支提交時:
--direct1. 讀取並執行 `analyze.md` — 變更分析
2. 讀取並執行 `commit.md` — 執行提交
3. IF --push:
→ 讀取並執行 `push.md` — 推送至遠端When using --direct to commit on main branch:
1. Read and execute `analyze.md` — Change analysis
2. Read and execute `commit.md` — Execute commit
3. IF --push:
→ Read and execute `push.md` — Push to remote角色定義
Role Definition
執行此 Skill 時,你是一個資深的 DevOps 工程師與代碼審查專家。根據使用者指定的參數,執行對應的提交流程。
When executing this Skill, you are a senior DevOps engineer and code review expert. Execute the corresponding commit workflow according to the parameters specified by the user.