mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-19 00:53:42 -05:00
Refined my fzf git checkout, allows passing in branch name to pre-fill search, and auto-checks out the branch if there's only 1 result
@@ -102,8 +102,9 @@ function fco -d "Fuzzy-find and checkout a branch"
|
||||
git branch --all | grep -v HEAD | string trim | fzf | read -l result; and git checkout "$result"
|
||||
end
|
||||
|
||||
function fco -d "Fuzzy-find and checkout a branch (alternate method)"
|
||||
git for-each-ref --format='%(refname:short)' refs/heads | fzf --height 10% --layout=reverse --border | xargs git checkout
|
||||
function fco -d "Use `fzf` to choose which branch to check out" --argument-names branch
|
||||
set -q branch[1]; or set branch ''
|
||||
git for-each-ref --format='%(refname:short)' refs/heads | fzf --height 10% --layout=reverse --border --query=$branch --select-1 | xargs git checkout
|
||||
end
|
||||
|
||||
function fcoc -d "Fuzzy-find and checkout a commit"
|
||||
|
||||
Reference in New Issue
Block a user