mirror of
https://github.com/Xevion/dotfiles.git
synced 2026-01-31 04:24:10 -06:00
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
17 lines
570 B
Fish
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
|