Add ability to checkout existing branch with gcb

This commit is contained in:
Chris Apple 2022-08-16 09:52:51 -07:00
parent bdef69083c
commit d4b4ce3908

View file

@ -304,7 +304,11 @@ function forgit::checkout::branch -d "git checkout branch selector" --argument-n
forgit::inside_work_tree || return 1 forgit::inside_work_tree || return 1
if test -n "$input_branch_name" if test -n "$input_branch_name"
git checkout -b "$input_branch_name" if git branch --list | grep "$input_branch_name" > /dev/null
git switch "$input_branch_name"
else
git switch -c "$input_branch_name"
end
set checkout_status $status set checkout_status $status
git status --short git status --short
return $checkout_status return $checkout_status