diff options
-rwxr-xr-x | git-base.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/git-base.sh b/git-base.sh index baed750..000b184 100755 --- a/git-base.sh +++ b/git-base.sh @@ -122,7 +122,8 @@ readable_branch_name() { } remote_branch_name() { - local remoteBranch="$(git for-each-ref --format='%(upstream:short)' refs/heads "$(git symbolic-ref -q HEAD)" )" + local localRef="$(git symbolic-ref -q HEAD 2>/dev/null)" + local remoteBranch="$(git for-each-ref --format='%(upstream:short)' refs/heads $localRef )" if [[ -n $remoteBranch ]]; then echo $remoteBranch return 0 |