Create Branch

作者 getsentryd18b7aa8ba87無授權條款1K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫5 天前更新

Create a git branch following Sentry naming conventions. Use when asked to "create a branch", "new branch", "start a branch", "make a branch", "switch to a new branch", or when starting new work on the default branch.

AI 產生的概覽

依照 Sentry 命名規範建立 git 分支,並依目前工作推導分支類型與描述。

功能
此技能引導代理建立符合 Sentry 風格的分支名稱,格式為 type/short-description。它會依使用者提供的參數或本機 git 變更決定工作描述,分類分支類型(feat、fix、ref、chore 等),並在不詢問的情況下選擇基礎分支。接著以附加數字後綴避免名稱衝突,執行 git checkout -b,並回報最終分支名稱。
適用情境
當被要求建立、開始、新增或切換到新分支時,或在預設分支上開始新工作時使用。適用於遵循 Sentry 分支命名規範的程式碼倉庫。
執行需求
需要 git 倉庫以及代理可用的 git 命令列工具。未包含指令碼或憑證,僅為指示說明。

Create Branch

Create a git branch following Sentry naming conventions. Keep this workflow non-interactive unless the user explicitly asks to choose the name manually.

Workflow

  1. Resolve the work description:

    • If $ARGUMENTS is present, use it
    • Otherwise inspect:
      bash
      git diffgit diff --cachedgit status --short
    • If there are local changes, derive a short description from the diff
    • If there are no local changes, use a generic description like repo-maintenance, tooling-update, or work-in-progress
  2. Classify the branch type:

TypeUse when
featNew functionality
fixBroken behavior now works
refBehavior stays the same, structure changes
choreMaintenance of existing tooling/config
perfSame behavior, faster
styleVisual or formatting only
docsDocumentation only
testTests only
ciCI/CD config
buildBuild system
metaRepo metadata
licenseLicense changes

When unsure: use feat for new things, ref for restructuring, chore for maintenance.

  1. Generate <type>/<short-description>. Keep <short-description> kebab-case, ASCII-only, and ideally 3 to 6 words.

  2. Choose the base without prompting:

    bash
    git branch --show-currentgit remote | grep -qx origin && echo origin || git remote | head -1git symbolic-ref refs/remotes/<remote>/HEAD 2>/dev/null | sed 's|refs/remotes/<remote>/||' | tr -d '[:space:]'
    • If default branch detection fails, fall back to main, then master, then the current branch
    • If on a detached HEAD, branch from the current commit
    • If already on a non-default branch, branch from the current branch
    • Only switch to the default branch when the user explicitly asks
  3. Avoid collisions by appending -2, -3, and so on until the name is unused locally and remotely.

  4. Create the branch:

    bash
    git checkout -b <branch-name>

    Report the final branch name, but do not stop for confirmation.

References

來源與署名

來源:getsentry/skills位於skills/create-branch提交d18b7aa

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架