From 572ae0dd462e8765af383102c9745c4f4655c107 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Tue, 23 Jun 2020 09:29:06 +1000 Subject: [PATCH] feat(browse): automatically select origin remote if one exists, fallback to first otherwise --- bin/git-browse | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/git-browse b/bin/git-browse index bb4ad241c..8f9e183c5 100755 --- a/bin/git-browse +++ b/bin/git-browse @@ -2,7 +2,8 @@ if [[ $1 == "" ]] then - remote=$(git remote | head -n 1) + branch=$(git rev-parse --abbrev-ref HEAD) + remote=$(git config branch."${branch}".remote || echo "origin") else remote=$1 fi