From c31b5cbc0110e7298374281039711fb4e8571785 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Thu, 20 Aug 2015 09:48:11 -0700 Subject: [PATCH] use configured remote for current branch instead of "origin" --- git-open-in-github | 5 +++-- git-push-feature-branch | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/git-open-in-github b/git-open-in-github index 843edd9..e7da33f 100755 --- a/git-open-in-github +++ b/git-open-in-github @@ -1,7 +1,8 @@ #!/bin/sh -REMOTE="${1:-origin}" -BRANCH="${2:-$(git rev-parse --abbrev-ref HEAD)}" +CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) +REMOTE="${1:-$(git config --get branch.${CURRENT_BRANCH}.remote)}" +BRANCH="${2:-$CURRENT_BRANCH}" REPO=$(git config --get remote.${REMOTE}.url | cut -d':' -f2 | cut -d'.' -f1) if [[ -z "$REPO" ]] || [[ -z "$BRANCH" ]]; then echo "usage: $(basename "$0") " diff --git a/git-push-feature-branch b/git-push-feature-branch index 01f2926..51c8551 100755 --- a/git-push-feature-branch +++ b/git-push-feature-branch @@ -2,8 +2,9 @@ set -e # bail on errors -REMOTE="${1:-origin}" -BRANCH="${2:-$(git rev-parse --abbrev-ref HEAD)}" +CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) +REMOTE="${1:-$(git config --get branch.${CURRENT_BRANCH}.remote)}" +BRANCH="${2:-$CURRENT_BRANCH}" git update "$REMOTE" develop git checkout develop