Skip to content

fix: warn and prompt on branch existence during create - #21

Merged
sadpandajoe merged 4 commits into
mainfrom
fix-missing-branch
Apr 16, 2026
Merged

fix: warn and prompt on branch existence during create#21
sadpandajoe merged 4 commits into
mainfrom
fix-missing-branch

Conversation

@sadpandajoe

Copy link
Copy Markdown
Owner

Summary

  • repo create now checks branch existence in both directions: warns when a branch doesn't exist on remote (with "Did you mean?" suggestions), and prompts with branch info when it already exists
  • When an existing remote branch is found, the user can choose to use it, enter a different name, or cancel
  • --yes flag auto-accepts in both cases for non-interactive use

Changes

  • git_ops: Added get_branch_info(), find_similar_branches(), list_remote_branches(), and branch_exists() helpers for branch discovery
  • create command: Restructured branch check into a loop that handles both missing and existing branches, with interactive numbered-choice menu showing last commit and age
  • tests: Added 9 CLI tests covering all prompt paths (confirm, cancel, rename, --yes, non-tty) and 4 unit tests for get_branch_info

Test plan

  • 281 tests pass (pytest tests/)
  • Manual: repo create <repo> <existing-branch> shows info + menu
  • Manual: repo create <repo> <typo-branch> shows suggestions

sadpandajoe and others added 4 commits April 15, 2026 20:14
Previously `repo create` silently created a new branch from origin/HEAD
when the requested branch name didn't exist anywhere. This caused
confusion when a branch existed on the remote with a slightly different
name (e.g. a typo). Now the CLI warns the user, suggests similar branch
names ("Did you mean?"), and asks for confirmation before proceeding.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Previously, `repo create` silently used an existing remote branch without
informing the user. Now it shows branch info (last commit, age) and offers
options: use existing, enter a different name, or cancel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sadpandajoe
sadpandajoe merged commit e2c11cf into main Apr 16, 2026
2 checks passed
@sadpandajoe
sadpandajoe deleted the fix-missing-branch branch April 16, 2026 05:23
@sadpandajoe sadpandajoe mentioned this pull request Apr 29, 2026
2 tasks
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