/branch
Create or manage a well-named working branch from an up-to-date base, following the repository's branching convention. Handles uncommitted changes safely, suggests names from the task, and never deletes branches or force-pushes without explicit approval.
What it does
Create or manage a well-named working branch from an up-to-date base, following the repository's branching convention. Handles uncommitted changes safely, suggests names from the task, and never deletes branches or force-pushes without explicit approval.
- Category
- gitworkflowversion-control
- Platforms
- generic
- Capabilities
- version-controlbranch-management
Example tasks
- /branch add rate limiting to the public API
- /branch hotfix for the broken password reset email
- /branch list which local branches are already merged
Works with
Related skills
Recommended alongside
Permissions summary
Files
Reads files only
Shell
Runs a limited set of commands
Network
No network
Permissions are declared in the component manifest and compiled into each client's tool list. Components are built for least privilege.
Supported environments
| Client | Support | Installed as |
|---|---|---|
| Claude Code | Native | .claude/commands/<id>.md |
| OpenAI Codex | Adapter | .codex/prompts/<id>.md |
| Cursor | Native | .cursor/commands/<id>.md |
| VS Code (Copilot) | Native | .github/prompts/<id>.prompt.md |
| Generic markdown | Adapter | docs/forgekit/commands/<id>.md |
Claude Code is the native reference. Other clients use adapters, so behaviour is close but not identical. See the compatibility matrix.
Included in packs
Full command (free preview)
This is a free component, so its complete content is public. It is exactly what gets installed (before client-specific formatting).
Create or manage a git branch for: $ARGUMENTS
Allowed git commands: status, branch (list, create, and delete only with approval), switch, checkout -b, fetch, log, diff, merge-base, stash (only with the user's consent), rev-parse, config --get. Never run push --force, reset --hard, branch -D, rebase on shared branches, or delete remote branches unless the user explicitly asks for that exact action.
- Detect the convention. Read
CONTRIBUTING,docs/, CI branch filters, andgit branch -aplus recent merged branch names to learn the prefix scheme (feat/,fix/,chore/,user/name/, ticket ids likeABC-123-) and the trunk (main,master,develop, release branches). Follow it; if there is none, use<type>/<short-kebab-description>with types matching Conventional Commits. - Check current state.
git status --shortandgit branch --show-current. If there are uncommitted changes, tell the user and offer: carry them onto the new branch (the default forswitch -c, safe), commit them first with/commit, or stash. Do not discard anything. - Pick the base. Identify the correct base (trunk,
develop, or a release branch for hotfixes). Rungit fetchand compare the local base with its upstream (git rev-list --left-right --count base...origin/base). If the local base is behind, branch from the up-to-date upstream ref or ask before fast-forwarding; never create a branch from a stale base silently. - Name it. Derive a lowercase kebab-case name of at most about 50 characters from the task, include a ticket id only if the user gave one (never invent it), avoid spaces, uppercase, trailing slashes, and names that already exist locally or on the remote.
- Create and verify.
git switch -c <name> <base>; confirm withgit branch --show-currentandgit log --oneline -1. - Other actions. For list/cleanup requests, show local branches that are merged into the trunk (
git branch --merged <trunk>) and stale ones, and propose deletions as a list with the exact commands; do not run deletion without confirmation, and never touch the trunk, the current branch, or unmerged branches with unpushed work without a warning.
Constraints: do not push, set upstream, or open pull requests; mention /pr for that.
Output: the branch created (name, base commit, upstream state), how uncommitted changes were handled, the convention you followed and where you found it, and any suggested next step.
Version and changelog
Latest version 1.0.0. Requires DevBuildKit CLI 1.0.0 or newer.
Changelog — /branch
1.0.0
- Initial release.