You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--no-cd flag ignored when using interactive picker #1330
I use worktrunk with tmux — each worktree has a corresponding tmux session, and I have a post-switch hook that switches my tmux client to the matching session. Because of this,
I use --no-cd so the shell in the current tmux session doesn't change directories (I only want the tmux switch, not a directory change in the source session).
Expected behavior:
wt switch --no-cd should skip the directory change regardless of whether a branch is specified directly or selected via the interactive picker.
Actual behavior:
wt switch --no-cd main — works correctly, no directory change, hooks run as expected
wt switch --no-cd (opens picker, select a branch) — the directory change still happens after selection
Use case:
~/.config/worktrunk/config.toml
[post-switch]
tmux = """
SESSION="mpos-{{ branch | sanitize }}"
if tmux has-session -t "$SESSION" 2>/dev/null; then
if [ -n "${TMUX:-}" ]; then
tmux switch-client -t "$SESSION"
else
tmux attach-session -t "$SESSION"
fi
fi
"""
alias wts="wt switch --no-cd"
When I run wts from my main tmux session, pick a branch, and then switch back to the main session, the shell's working directory has changed to the selected worktree's path.
Thanks for reporting this! I was able to identify the root cause: the interactive picker hardcoded change_dir: true when calling handle_switch_output(), so the --no-cd flag was never plumbed through from the CLI to the picker's switch path.
I've opened #1331 with a fix. A maintainer will review it shortly.
Activity
fix: pass --no-cd flag through to interactive picker
worktrunk-bot commentedon Mar 7, 2026
Thanks for reporting this! I was able to identify the root cause: the interactive picker hardcoded
change_dir: truewhen callinghandle_switch_output(), so the--no-cdflag was never plumbed through from the CLI to the picker's switch path.I've opened #1331 with a fix. A maintainer will review it shortly.
fix: pass --no-cd flag through to interactive picker (#1331)