Check remote branches to prevent duplicate branch numbers#1019
Merged
localden merged 3 commits intogithub:mainfrom Oct 23, 2025
Merged
Conversation
- Add --number parameter to create-new-feature scripts (bash & PowerShell) - Add check_existing_branches() function to fetch and scan remote branches - Update branch numbering logic to check remotes before creating new branches - Update /speckit.specify command to document remote branch checking workflow - Prevents duplicate branch numbers when branches exist on remotes but not locally - Maintains backward compatibility with existing workflows - Falls back to local directory scanning when Git is not available
- Use git ls-remote for more reliable remote branch detection - Check remote branches, local branches, AND specs directories - Match exact short-name pattern to avoid false positives - Ensures no duplicate numbers across all sources
localden
approved these changes
Oct 23, 2025
Dario-Arcos
added a commit
to Dario-Arcos/ai-framework
that referenced
this pull request
Oct 23, 2025
- Add --number parameter for manual override - Add check_existing_branches() function to verify 3 sources: * Remote branches (git ls-remote) * Local branches (git branch) * Specs directories (find) - Use exact pattern matching to prevent false positives - Maintain backward compatibility with non-git repos - Update documentation with Branch Number Detection section Implements spec-kit v0.0.79 branch detection enhancement Based on github/spec-kit#1019 Fixes: Duplicate feature numbers when team members have remote branches Breaking changes: None Migration: No action required - fully backward compatible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds remote branch checking to prevent duplicate branch numbers when creating new features. The current implementation only checks local
specs/directories, which can lead to duplicate branch numbers when branches exist on remotes (e.g., in open pull requests) but not locally.Motivation
When working in a team environment, developers may have feature branches on remotes that don't exist locally. The current branch numbering logic only scans the local
specs/directory, which can result in:feature/001-*branches)This PR solves this by checking all three sources: remote branches, local branches, and specs directories.
Changes
--numberparameter tocreate-new-feature.shandcreate-new-feature.ps1for manual branch number specificationcheck_existing_branches()function (bash) andGet-NextBranchNumberfunction (PowerShell) to fetch and scan remote branchesgit ls-remote), local branches, and specs directories[0-9]+-<short-name>$) to prevent false positives/speckit.specifycommand documentation to include remote branch checking workflowTesting
--numberparameter override - manual number specification worksChecklist
AI Assistance Disclosure
This PR was developed with assistance from Amazon Q Developer CLI. The implementation was:
Related Issues