Last active
May 11, 2019 09:27
-
-
Save amoblin/d59ef96f7068b4b52a8e4833a9e5044b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
# code from https://stackoverflow.com/questions/7101145/how-to-configure-specific-upstream-push-refspec-for-git-when-used-with-gerrit/7141743#7141743 | |
if [ -z "$1" ]; then | |
REMOTE=origin | |
else | |
REMOTE=$1 | |
fi | |
if [ -z "$2" ]; then | |
BRANCH=`git symbolic-ref HEAD` | |
case $BRANCH in | |
refs/heads/*) | |
BRANCH=`basename $BRANCH` | |
;; | |
*) | |
echo "I can't figure out which branch you are on." | |
exit 1 | |
;; | |
esac | |
else | |
BRANCH=$2 | |
fi | |
git push $REMOTE HEAD:refs/for/$BRANCH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment