fix: gcb can switch to an existed branch

This commit is contained in:
Wenxuan Zhang 2021-09-23 10:17:23 +08:00
parent 9f3a423920
commit 8107352941
No known key found for this signature in database
GPG key ID: CCAF35548C65530F
2 changed files with 2 additions and 2 deletions

View file

@ -217,7 +217,7 @@ 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"
git checkout -B "$input_branch_name"
set checkout_status $status
git status --short
return $checkout_status

View file

@ -218,7 +218,7 @@ forgit::checkout::file() {
# git checkout-branch selector
forgit::checkout::branch() {
forgit::inside_work_tree || return 1
[[ $# -ne 0 ]] && { git checkout -b "$@"; return $?; }
[[ $# -ne 0 ]] && { git checkout -B "$@"; return $?; }
local cmd preview opts branch
cmd="git branch --color=always --verbose --all | sort -k1.1,1.1 -r"
preview="git log {1} --graph --pretty=format:'$forgit_log_format' --color=always --abbrev-commit --date=relative"