Skip to content

Commit 79c4e5a

Browse files
authored
Fix: create branch when checking non origin remote (#430)
1 parent 8c0355c commit 79c4e5a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bin/git-forgit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -849,10 +849,10 @@ _forgit_checkout_branch() {
849849
[[ -z "$branch" ]] && return 1
850850

851851
# track the remote branch if possible
852-
if [[ "$branch" == "remotes/origin/"* ]]; then
853-
if git branch | grep -qw "${branch#remotes/origin/}"; then
852+
if [[ "$branch" == "remotes/"* ]]; then
853+
if git branch | grep -qw "${branch#remotes/*/}"; then
854854
# hack to force creating a new branch which tracks the remote if a local branch already exists
855-
_forgit_git_checkout_branch -b "track/${branch#remotes/origin/}" --track "$branch"
855+
_forgit_git_checkout_branch -b "track/${branch#remotes/*/}" --track "$branch"
856856
elif ! _forgit_git_checkout_branch --track "$branch" 2>/dev/null; then
857857
_forgit_git_checkout_branch "$branch"
858858
fi

0 commit comments

Comments
 (0)