Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

split-branch

БесплатноБез исполняемых скриптовНе проверен

Split a branch with N commits into N branches with 1 commit each. Use when the user asks to split a branch into single-commit branches.

motlinот motlin★ 20 звёзд на GitHub

Об этом скилле

Split Branch

Split the current branch into one branch per commit. Never delete, modify, or force-push the original branch or any existing branch.

Use the code:cli skill.

Base Branch and Commits

Use the base branch the user named. Otherwise, in order: the upstream tracking branch, then main or master, whichever exists. If none exists, ask.

git log --oneline --reverse <base-branch>..HEAD

With 0 commits there is nothing to split; with 1, splitting isn't useful. Say so and stop.

Branch Names

For each commit, derive a short kebab-case name (3-5 words) from its subject, using prefixes like add-, fix-, update-, remove-, refactor- where they fit. For example, "Fix null pointer in checkout" becomes fix-checkout-null-pointer.

Show the proposal:

Splitting branch `<current-branch>` into <N> branches:

- <short-sha> <commit-subject> → <semantic-branch-name>
- <short-sha> <commit-subject> → <semantic-branch-name>
...

Ask via AskUserQuestion:

  • "Proceed with these names" (recommended)
  • "Regenerate names"
  • "Use numbered naming" (<current-branch>-1, -2, etc.)
  • "Cancel"

Create the Branches

Work from oldest commit to newest. For each commit, check whether the target branch exists:

git rev-parse --verify <semantic-branch-name> 2>/dev/null

If it exists and its tip equals <commit-sha>, skip it. If it exists with a different tip, append a numeric suffix (e.g., add-user-model-2). Then:

git branch <semantic-branch-name> <base-branch>
git switch <semantic-branch-name>
git cherry-pick <commit-sha>

If a cherry-pick conflicts, tell the user which commit and branch, leave the branch conflicted, and continue with the rest. When done, return to the original branch with git switch <original-branch>.

Summary

List the preserved original branch, each new branch with its commit, skipped branches, and branches that need manual conflict resolution:

Successfully split `feature-auth` into 3 branches:

Original branch (preserved):
  feature-auth (3 commits)

New single-commit branches:
  ✓ add-user-model: abc1234 Add user model
  ✓ add-login-endpoint: def5678 Add login endpoint
  ⊘ add-session-handling: ghi9012 Add session handling (already exists, skipped)

2 branches created, 1 skipped.

Установить split-branch в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл split-branch?

Split a branch with N commits into N branches with 1 commit each. Use when the user asks to split a branch into single-commit branches.

Как установить скилл split-branch?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл split-branch запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить split-branch с