mirror of
https://github.com/wfxr/forgit.git
synced 2026-09-10 07:16:23 -04:00
Add ability to checkout existing branch with gcb
This commit is contained in:
parent
bdef69083c
commit
d4b4ce3908
|
|
@ -304,7 +304,11 @@ function forgit::checkout::branch -d "git checkout branch selector" --argument-n
|
|||
forgit::inside_work_tree || return 1
|
||||
|
||||
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
|
||||
git status --short
|
||||
return $checkout_status
|
||||
|
|
|
|||
Loading…
Reference in a new issue