Skip to content

fix(dev): always warn when creating worktree on existing branch#430

Closed
basnijholt wants to merge 1 commit intomainfrom
fix/consistent-existing-branch-warning
Closed

fix(dev): always warn when creating worktree on existing branch#430
basnijholt wants to merge 1 commit intomainfrom
fix/consistent-existing-branch-warning

Conversation

@basnijholt
Copy link
Owner

Summary

  • dev new now always warns when the specified branch name already exists in git, not just when --from is also specified
  • Without --from: shows "Branch 'X' already exists. Using existing branch (use a different name to start fresh)."
  • With --from: keeps the existing message "Branch 'X' already exists. Using existing branch instead of creating from 'Y'."

Previously, dev new my-existing-branch would silently check out the existing branch without any indication, which is surprising when the user's intent is to start fresh.

Test plan

  • Updated test_no_warning_when_from_not_specifiedtest_warning_when_from_not_specified_but_branch_exists to assert warning is shown
  • All 271 dev tests pass
  • Pre-commit hooks pass (ruff, mypy, etc.)

Previously, `dev new` only warned about reusing an existing branch when
`--from` was also specified. Without `--from`, it silently checked out
the existing branch, which is surprising when the intent is to start
fresh. Now a warning is shown in both cases with context-appropriate
messages.
@basnijholt basnijholt closed this Feb 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.

1 participant