Created
December 8, 2023 06:18
-
-
Save towry/ed812031a117e8e155350775aadb914c to your computer and use it in GitHub Desktop.
quickly switch between git workspace folders.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this fish function in your fish config. | |
# | |
# usage: | |
# ~:> wt | |
# or | |
# ~:> wt path_or_branch_keyword | |
function wt | |
set worktree (git worktree list | awk '{print $1, $NF}' | awk -v home="$HOME" '{sub(home, "~"); print $1, $NF}' | fzf --exact --reverse -1 -0 --query=$argv[1] | awk '{print $1}') | |
if test -n "$worktree" | |
eval cd $worktree | |
end | |
end | |
dependencies:
- git
- fzf
- zoxide (optional)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use with zoxide to quickly jump to folder and switch to git workspace folder:
usage: