extensions/git/commands/speckit.git.feature.md
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.
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
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:
--short-name, --number, and --timestamp flags are ignoredFEATURE_NUM is extracted when the final path segment starts with a numeric or timestamp feature marker (for example 042-name, feat/042-name, or jdoe/app/042-name), otherwise set to the full branch namegit rev-parse --is-inside-work-tree 2>/dev/nullDetermine the branch numbering strategy by checking configuration in this order:
.specify/extensions/git/git-config.yml for branch_numbering value.specify/init-options.json for feature_numbering value (inherit from core).specify/init-options.json for branch_numbering value (deprecated, backward compatibility — will be removed in a future release)sequential if none of the above existCheck .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 slugFor 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}.
Generate a concise short name (2-4 words) for the branch:
Run the appropriate script based on your platform:
.specify/extensions/git/scripts/bash/create-new-feature-branch.sh --json --short-name "<short-name>" "<feature description>".specify/extensions/git/scripts/bash/create-new-feature-branch.sh --json --timestamp --short-name "<short-name>" "<feature description>".specify/extensions/git/scripts/powershell/create-new-feature-branch.ps1 -Json -ShortName "<short-name>" "<feature description>".specify/extensions/git/scripts/powershell/create-new-feature-branch.ps1 -Json -Timestamp -ShortName "<short-name>" "<feature description>"IMPORTANT:
--number — the script determines the correct next number automatically--json for Bash, -Json for PowerShell) so the output can be parsed reliablyBRANCH_NAME and FEATURE_NUMbranch_template; the script reads the git extension config and applies it consistentlyIf Git is not installed or the current directory is not a Git repository:
[specify] Warning: Git repository not detected; skipped branch creationBRANCH_NAME and FEATURE_NUM so the caller can reference themThe script outputs JSON with:
BRANCH_NAME: The branch name (e.g., 003-user-auth, 20260319-143022-user-auth, or jdoe/web/003-user-auth)FEATURE_NUM: The numeric or timestamp prefix used