From 79c4e5a4c495ab75ccadca793de0997e78a3c5e9 Mon Sep 17 00:00:00 2001 From: sandr01d <88739791+sandr01d@users.noreply.github.com> Date: Tue, 22 Apr 2025 18:08:37 +0200 Subject: [PATCH] Fix: create branch when checking non origin remote (#430) --- bin/git-forgit | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/git-forgit b/bin/git-forgit index 4a6a66d..27a893d 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -849,10 +849,10 @@ _forgit_checkout_branch() { [[ -z "$branch" ]] && return 1 # track the remote branch if possible - if [[ "$branch" == "remotes/origin/"* ]]; then - if git branch | grep -qw "${branch#remotes/origin/}"; then + if [[ "$branch" == "remotes/"* ]]; then + if git branch | grep -qw "${branch#remotes/*/}"; then # hack to force creating a new branch which tracks the remote if a local branch already exists - _forgit_git_checkout_branch -b "track/${branch#remotes/origin/}" --track "$branch" + _forgit_git_checkout_branch -b "track/${branch#remotes/*/}" --track "$branch" elif ! _forgit_git_checkout_branch --track "$branch" 2>/dev/null; then _forgit_git_checkout_branch "$branch" fi