Skip to content

ez switch should not claim to switch when it doesn't #15

Description

@dezren39

Problem

When the target branch is in a different worktree and the shell wrapper isn't active, ez switch prints "Switching to ..." but doesn't actually change the working directory. This is misleading.

Current behavior

  • ez switch feat/x where feat/x is in a worktree
  • Prints "Switching to feat/x" and a path
  • User's shell stays in the original directory
  • No indication that the switch didn't actually happen

Implemented fix (PR-C: feat/worktree-ops)

  • Detects when shell wrapper isn't active
  • Prints clear error message with manual cd instructions
  • Exits with code 5 (usage error)
  • Added --no-cd-required flag for scripts/agents that handle cd themselves (exits 0, prints path)
✗ Could not switch to `feat/x` — branch is checked out in a different worktree.
  Shell integration is not active (run `ez setup` to enable auto-cd).
  To switch manually, run:
  cd /path/to/.worktrees/feat-x

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions