Skip to content

feat(switch): add command to quickly switch between worktrees#78

Merged
javoire merged 2 commits intomainfrom
feat/switch-command
Mar 10, 2026
Merged

feat(switch): add command to quickly switch between worktrees#78
javoire merged 2 commits intomainfrom
feat/switch-command

Conversation

@javoire
Copy link
Owner

@javoire javoire commented Mar 10, 2026

Summary

  • Adds stack switch <branch> to print cd <path> for a branch's worktree (or repo root for base branch)
  • No-args mode shows an interactive picker of all worktrees + main repo
  • --init outputs an ss() shell function that wraps switch with actual cd
  • --install appends the init line to ~/.zshrc or ~/.bashrc

🤖 Generated with Claude Code

javoire and others added 2 commits March 10, 2026 11:55
Adds `stack switch` for fast worktree navigation:
- `stack switch <branch>` prints `cd <path>` for that branch's worktree
- `stack switch` (no args) shows an interactive picker
- `--init` outputs an `ss()` shell function wrapping switch with cd
- `--install` appends the init line to shell config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Quote paths in cd output for shell safety
- Use skipGitValidation annotation instead of PersistentPreRun override
- Use initLine variable in contains check
- DRY up getHomeDir in runSwitchInstall
- Add dry-run support to runSwitchInstall

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@javoire javoire marked this pull request as ready for review March 10, 2026 17:37
@javoire javoire merged commit 1cc1ea1 into main Mar 10, 2026
1 check passed
@javoire javoire deleted the feat/switch-command branch March 10, 2026 17:37
javoire pushed a commit that referenced this pull request Mar 10, 2026
…026-03-10)

### Features

* **switch:** add command to quickly switch between worktrees ([#78](#78)) ([1cc1ea1](1cc1ea1))
@javoire
Copy link
Owner Author

javoire commented Mar 10, 2026

🎉 This PR is included in version 1.22.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant