Skip to content

Conversation

Copy link

Copilot AI commented Nov 15, 2025

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Fix branch numbering to increment globally across all features

The /specify command was always creating branches starting at 001, ignoring existing feature branches with different short-names.

Problem

Given existing branches 001-user-auth, 002-payment-flow, 003-dashboard, creating a new feature would incorrectly produce 001-admin-panel instead of 004-admin-panel.

Root Cause

The check_existing_branches() (bash) and Get-NextBranchNumber() (PowerShell) functions filtered by exact short-name match:

# Before: Only finds branches matching the specific short-name
grep -E "refs/heads/[0-9]+-${short_name}$"

# After: Finds all feature branches
grep -E "refs/heads/[0-9]+-"

This meant each unique short-name started its numbering from 001, rather than continuing the global sequence.

Changes

Bash (scripts/bash/create-new-feature.sh)

  • Changed remote, local, and specs directory searches to match pattern [0-9]+-* instead of [0-9]+-${short_name}
  • Added octal-to-decimal conversion (10#$num) to handle leading zeros correctly

PowerShell (scripts/powershell/create-new-feature.ps1)

  • Applied equivalent regex changes to match all feature branches
  • Maintains parity with bash implementation

Documentation (templates/commands/specify.md)

  • Updated instructions to clarify branch numbers increment globally across all features

Behavior

Branch numbers now increment sequentially regardless of short-name:

  • 001-user-auth002-payment-flow003-dashboard004-admin-panel

This pull request was created as a result of the following prompt from Copilot chat.

Fix branch numbering to increment globally across all features

The /specify command was always creating branches starting at 001, ignoring existing feature branches with different short-names.

Problem

Given existing branches 001-user-auth, 002-payment-flow, 003-dashboard, creating a new feature would incorrectly produce 001-admin-panel instead of 004-admin-panel.

Root Cause

The check_existing_branches() (bash) and Get-NextBranchNumber() (PowerShell) functions filtered by exact short-name match:

# Before: Only finds branches matching the specific short-name
grep -E "refs/heads/[0-9]+-${short_name}$"

# After: Finds all feature branches
grep -E "refs/heads/[0-9]+-"

This meant each unique short-name started its numbering from 001, rather than continuing the global sequence.

Changes

Bash (scripts/bash/create-new-feature.sh)

  • Changed remote, local, and specs directory searches to match pattern [0-9]+-* instead of [0-9]+-${short_name}
  • Added octal-to-decimal conversion (10#$num) to handle leading zeros correctly

PowerShell (scripts/powershell/create-new-feature.ps1)

  • Applied equivalent regex changes to match all feature branches
  • Maintains parity with bash implementation

Documentation (templates/commands/specify.md)

  • Updated instructions to clarify branch numbers increment globally across all features

Behavior

Branch numbers now increment sequentially regardless of short-name:

  • 001-user-auth002-payment-flow003-dashboard004-admin-panel

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Nov 15, 2025
Copilot stopped work on behalf of danieldekay due to an error November 15, 2025 15:30
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.

1 participant