Skip to content

fix(git): surface checkout stderr for existing branches#2122

Merged
mnriem merged 1 commit intogithub:mainfrom
PascalThuet:fix/existing-branch-checkout-stderr
Apr 8, 2026
Merged

fix(git): surface checkout stderr for existing branches#2122
mnriem merged 1 commit intogithub:mainfrom
PascalThuet:fix/existing-branch-checkout-stderr

Conversation

@PascalThuet
Copy link
Copy Markdown
Contributor

Summary

This PR preserves Git's original stderr when create-new-feature fails while switching to an existing branch in the --allow-existing-branch flow.

Changes

  • capture git checkout stderr in the Bash and PowerShell scripts
  • apply the same fix to the extensions/git script variants
  • add a regression test that reproduces a real checkout failure caused by local changes
  • add parity guards for the git extension script copies

Testing

  • pytest tests/test_timestamp_branches.py

Context

Follow-up to #2089.

Fixes #2105.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 checkout stderr on existing-branch switch failures in Bash and PowerShell scripts.
  • Apply the same behavior to the extensions/git script 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 mnriem merged commit 838bd0f into github:main Apr 8, 2026
12 checks passed
@PascalThuet PascalThuet deleted the fix/existing-branch-checkout-stderr branch April 10, 2026 03:36
brianluby pushed a commit to brianluby/spec-kit that referenced this pull request Apr 13, 2026
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.

[Bug]: create-new-feature.sh swallows git checkout stderr and makes branch failures impossible to diagnose

3 participants