Repository navigation
Conversation
When GIT_BRANCH_NAME names the branch that is already checked out, `git checkout -b` fails and the script reported "Branch already exists" and exited 1, unless --allow-existing-branch was passed. The branch is already in the requested state, so handle it the way the --allow-existing-branch path does and succeed without switching. Applied to the bash, PowerShell and Python scripts. A GIT_BRANCH_NAME naming a different existing branch still fails. Fixes github#5003 Assisted-by: Claude Code (model: Claude Sonnet 5.5, autonomous)
Add a PowerShell twin of the bash test for GIT_BRANCH_NAME naming the checked-out branch, use a case-sensitive comparison in the new PowerShell clause so a differently-cased branch is not mistaken for the current one, and document the behaviour in speckit.git.feature.md. Assisted-by: Claude Code (model: Claude Sonnet 5.5, autonomous)
This branch has not been deployed
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.
Fixes #5003.
Description
With
GIT_BRANCH_NAMEset to the branch that is already checked out,git checkout -bfails, so the feature-branch script reported "Branch already exists" and exited 1 unless--allow-existing-branchwas passed. The branch is already in the requested state, so the bash, PowerShell and Python scripts now succeed without switching, as the--allow-existing-branchpath does. AGIT_BRANCH_NAMEnaming a different existing branch still fails.Testing
Existing and new tests in the git extension suites: 129 passed, 0 failed (the new tests fail without the fix). I did not run the other checks.
uv run specify --helpuv sync && uv run pytestAI Disclosure
AI disclosure: Code and tests written by Claude Code (model: Claude Sonnet 5.5, autonomous), reviewed by two further agent passes.
Assisted-by: Claude Code (model: Claude Sonnet 5.5, autonomous)