From 5d15fd3532c9fe891cfaf3f083008f88a663175d Mon Sep 17 00:00:00 2001 From: Wenxuan Zhang Date: Tue, 26 Oct 2021 18:39:50 +0800 Subject: [PATCH] refactor: ci lint --- .github/pull_request_template.md | 4 ++-- forgit.plugin.zsh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6139a61..0450843 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -24,8 +24,8 @@ - Shell - [ ] bash - - [ ] zsh - - [ ] fish + - [ ] zsh + - [ ] fish - OS - [ ] Linux - [ ] Mac OS X diff --git a/forgit.plugin.zsh b/forgit.plugin.zsh index 5ea2e22..6dfa343 100755 --- a/forgit.plugin.zsh +++ b/forgit.plugin.zsh @@ -229,10 +229,10 @@ forgit::checkout::branch() { " branch="$(eval "$cmd" | FZF_DEFAULT_OPTS="$opts" fzf --preview="$preview" | awk '{print $1}')" [[ -z "$branch" ]] && return 1 - + # track the remote branch if possible if [[ "$branch" == "remotes/origin/"* ]]; then - if [[ -n $(git branch | grep -w "${branch#remotes/origin/}") ]]; then + if git branch | grep -qw "${branch#remotes/origin/}"; then # hack to force creating a new branch which tracks the remote if a local branch already exists git checkout -b "track/${branch#remotes/origin/}" --track "$branch" elif ! git checkout --track "$branch" 2>/dev/null; then