fix(git): surface checkout stderr for existing branches#2122
Merged
mnriem merged 1 commit intogithub:mainfrom Apr 8, 2026
Merged
fix(git): surface checkout stderr for existing branches#2122mnriem merged 1 commit intogithub:mainfrom
mnriem merged 1 commit intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves error diagnosability in the --allow-existing-branch flow by preserving and surfacing git checkout stderr when switching to an already-existing branch fails (e.g., due to local changes), and adds regression/parity tests to prevent reintroducing stderr suppression.
Changes:
- Capture and print
git checkoutstderr on existing-branch switch failures in Bash and PowerShell scripts. - Apply the same behavior to the
extensions/gitscript copies for parity. - Add a regression test reproducing a real-world checkout failure caused by conflicting local changes, plus static parity guards for extension script variants.
Show a summary per file
| File | Description |
|---|---|
| tests/test_timestamp_branches.py | Adds regression test for checkout failure stderr surfacing + static parity guards for main/extension script variants. |
| scripts/powershell/create-new-feature.ps1 | Captures git checkout stderr when switching to an existing branch and includes it in the error output. |
| scripts/bash/create-new-feature.sh | Captures git checkout stderr when switching to an existing branch and prints it on failure. |
| extensions/git/scripts/powershell/create-new-feature.ps1 | Mirrors PowerShell stderr-surfacing behavior for extension parity. |
| extensions/git/scripts/bash/create-new-feature.sh | Mirrors Bash stderr-surfacing behavior for extension parity. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 0
mnriem
approved these changes
Apr 8, 2026
brianluby
pushed a commit
to brianluby/spec-kit
that referenced
this pull request
Apr 13, 2026
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 preserves Git's original stderr when
create-new-featurefails while switching to an existing branch in the--allow-existing-branchflow.Changes
git checkoutstderr in the Bash and PowerShell scriptsextensions/gitscript variantsTesting
pytest tests/test_timestamp_branches.pyContext
Follow-up to
#2089.Fixes #2105.