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