use configured remote for current branch instead of "origin"
This commit is contained in:
parent
d1126138f7
commit
c31b5cbc01
2 changed files with 6 additions and 4 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
REMOTE="${1:-origin}"
|
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
BRANCH="${2:-$(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)
|
REPO=$(git config --get remote.${REMOTE}.url | cut -d':' -f2 | cut -d'.' -f1)
|
||||||
if [[ -z "$REPO" ]] || [[ -z "$BRANCH" ]]; then
|
if [[ -z "$REPO" ]] || [[ -z "$BRANCH" ]]; then
|
||||||
echo "usage: $(basename "$0") <remote> <branch (ref)>"
|
echo "usage: $(basename "$0") <remote> <branch (ref)>"
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
set -e # bail on errors
|
set -e # bail on errors
|
||||||
|
|
||||||
REMOTE="${1:-origin}"
|
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
BRANCH="${2:-$(git rev-parse --abbrev-ref HEAD)}"
|
REMOTE="${1:-$(git config --get branch.${CURRENT_BRANCH}.remote)}"
|
||||||
|
BRANCH="${2:-$CURRENT_BRANCH}"
|
||||||
|
|
||||||
git update "$REMOTE" develop
|
git update "$REMOTE" develop
|
||||||
git checkout develop
|
git checkout develop
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue