various additions from sim laptop
This commit is contained in:
parent
912a3282c5
commit
21e41141ef
13 changed files with 645 additions and 28 deletions
13
aliases/git
13
aliases/git
|
|
@ -88,3 +88,16 @@ gclone() {
|
|||
|
||||
git clone $url "$@"
|
||||
}
|
||||
|
||||
gwt() {
|
||||
local current_tree line prefix
|
||||
typeset -A trees
|
||||
prefix=$(git rev-parse --show-prefix)
|
||||
git worktree list --porcelain | while read line; do
|
||||
if [[ $line = worktree* ]]; then current_tree=${line##worktree }
|
||||
elif [[ $line = branch* ]]; then trees[${line##branch refs/heads/}]=$current_tree
|
||||
fi
|
||||
done
|
||||
local target=$(for k v in ${(kv)trees}; do echo "$k $v"; done | column -t | fzf ${1:+-q} ${1} -1| awk '{print $2}')
|
||||
[[ -n $target ]] && cd $target/$prefix
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue