Skip to content

Support namespaced git feature branch templates#3293

Draft
PascalThuet wants to merge 2 commits into
github:mainfrom
PascalThuet:feat/3081-monorepo-branch-template
Draft

Support namespaced git feature branch templates#3293
PascalThuet wants to merge 2 commits into
github:mainfrom
PascalThuet:feat/3081-monorepo-branch-template

Conversation

@PascalThuet

@PascalThuet PascalThuet commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds git extension branch_template config with {author}, {app}, {number}, and {slug} tokens, plus branch_prefix as a shorthand namespace.
  • Applies templates in both Bash and PowerShell feature-branch scripts while preserving the default {number}-{slug} branch shape.
  • Makes feature number extraction, branch-number scanning, and validation tolerant of path-style branch namespaces.

Why

Monorepo installs can have separate Spec Kit projects but one shared root Git branch namespace. This lets projects opt into names like jdoe/app-a/008-guided-tour without requiring separate Git repositories or changing downstream feature path resolution.

Fixes #3081.

Issue context

The implementation follows the concrete monorepo use case described in #3081 (comment). That comment is relevant because it identifies the target branch shape ({author}/{app}/{number}-{slug}) and points out that downstream commands already resolve feature directories through .specify/feature.json / SPECIFY_FEATURE_DIRECTORY, so branch creation and validation are the important places to make namespace-aware.

TDD sequence

  • dbe9203 adds failing coverage for branch templates, branch-prefix shorthand, namespace-scoped numbering, namespaced GIT_BRANCH_NAME extraction, and nested-prefix validation.
  • f48178d implements the behavior and documentation that make those tests pass.

Validation

  • Red check after the test commit: 5 targeted tests failed as expected.
  • Green check after implementation: .venv/bin/python -m pytest tests/extensions/git/test_git_extension.py tests/test_timestamp_branches.py -q
  • Result: 105 passed, 42 skipped.

Disclosure

Prepared on behalf of @PascalThuet by Codex (model: GPT-5, autonomous). Each commit includes an Assisted-by: trailer.

@mnriem

mnriem commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

I realize this still a draft, but I wanted to make sure that you should merge the template into the git-config.yml for ease of use

Assisted-by: Codex (model: GPT-5, autonomous)
Assisted-by: Codex (model: GPT-5, autonomous)
@PascalThuet PascalThuet force-pushed the feat/3081-monorepo-branch-template branch from 995f4cc to f48178d Compare July 1, 2026 21:32
@PascalThuet PascalThuet changed the title Add configurable git branch templates for monorepos Support namespaced git feature branch templates Jul 1, 2026
@PascalThuet

Copy link
Copy Markdown
Contributor Author

Thanks, done in the latest push. branch_template is now included in both git-config.yml and config-template.yml.

It defaults to "", which preserves the existing {number}-{slug} behavior. Users can set it to {author}/{app}/{number}-{slug} for monorepo-style branch names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Monorepo: feature branches share the root repo's branch namespace (no per-project Git scoping)

2 participants