Files
dotfiles/home/dot_config/fish/functions/wtcd.fish
Xevion 8804b425fb feat: add git worktree management utilities for Fish and Bash
Add comprehensive worktree tooling with FZF integration:
- wtb: create branch worktree with gitignored file cloning
- wtcd/wtr: interactive picker and multi-remove with FZF
- wtf/wth: feature/hotfix branch shortcuts
- wts/wtl: status overview and listing
- Automatic .worktrees/ organization and .gitignore management
2026-01-23 13:42:30 -06:00

17 lines
570 B
Fish

function wtcd --description "FZF-based worktree picker - cd into selected"
set -l root (git rev-parse --show-toplevel 2>/dev/null)
if test -z "$root"
echo "Not in a git repository" >&2
return 1
end
set -l selected (git worktree list | fzf --height=40% --reverse \
--header="Select worktree" \
--preview="git -C {1} log --oneline -5 2>/dev/null; echo ''; git -C {1} status --short 2>/dev/null")
if test -n "$selected"
set -l wt_path (echo "$selected" | awk '{print $1}')
cd "$wt_path"
end
end