Create Feature Branch
Create and switch to a new git feature branch for the given specification. This command handles branch creation only — the spec directory and files are created by the core __SPECKIT_COMMAND_SPECIFY__ workflow.
User Input
$ARGUMENTSYou MUST consider the user input before proceeding (if not empty).
Environment Variable Override
If the user explicitly provided GIT_BRANCH_NAME (e.g., via environment variable, argument, or in their request), pass it through to the script by setting the GIT_BRANCH_NAME environment variable before invoking the script. When GIT_BRANCH_NAME is set:
- The script uses the exact value as the branch name, bypassing all prefix/suffix generation
--short-name,--number, and--timestampflags are ignoredFEATURE_NUMis extracted when the final path segment starts with a numeric or timestamp feature marker (for example042-name,feat/042-name, orjdoe/app/042-name), otherwise set to the full branch name
Prerequisites
- Verify Git is available by running
git rev-parse --is-inside-work-tree 2>/dev/null - If Git is not available, warn the user and skip branch creation
Branch Numbering Mode
Determine the branch numbering strategy by checking configuration in this order:
- Check
.specify/extensions/git/git-config.ymlforbranch_numberingvalue - Check
.specify/init-options.jsonforfeature_numberingvalue (inherit from core) - Check
.specify/init-options.jsonforbranch_numberingvalue (deprecated, backward compatibility — will be removed in a future release) - Default to
sequentialif none of the above exist
Branch Name Template
Check .specify/extensions/git/git-config.yml for an optional branch_template value. If it is empty or missing, use the default branch shape \{number\}-\{slug\}. If it is set, \{slug\} must not appear before \{number\}, its final path segment must start with \{number\}-, and the script expands these tokens:
\{author\}: sanitized Git config author (user.name, falling back to the email local part)\{app\}: sanitized Spec Kit init directory name\{number\}: sequential number or timestamp\{slug\}: generated short branch slug
For monorepos, a template such as \{author\}/\{app\}/\{number\}-\{slug\} creates names like jdoe/web/008-guided-tour while preserving per-project feature numbering.
The script also accepts branch_prefix as a shorthand for simple namespaces; it expands to <branch_prefix>/\{number\}-\{slug\}.
Execution
Generate a concise short name (2-4 words) for the branch:
- Analyze the feature description and extract the most meaningful keywords
- Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
- Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
Run the appropriate script based on your platform: