Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Easy GitHub pull requests
#!/bin/bash
set -e
die() {
echo "$@" >&2 ; exit 1
}
BRANCH=$(git branch 2>/dev/null|grep -e ^* | tr -d \*\ )
test -n "$BRANCH" || die "No branch"
test $BRANCH != master || die "You should create a branch instead of working on master: git checkout -b my-awesome-contribution"
USER=$(git config --get github.user)
if [ -n "$USER" ]
then
REMOTE=$(git remote -v | grep -F $USER/ | head -n 1 | cut -f 1)
test -n "$REMOTE" || die "github.user is set, but no remote found"
else
REMOTE=$1
test -n "$REMOTE" || die "Remote not specified and github.user not set"
fi
URL=$(git config --get remote.$REMOTE.url | sed -e 's#^[^:/]\+:\(//[^/]\+/\)\?#https://github.com/#' -e 's#\.git$##' -e 's#/$##' )
test -n "$URL" || die "Couldn't get remote URL"
git push $REMOTE $BRANCH
git config branch.$BRANCH.remote $REMOTE
git-web--browse $URL/pull/new/$BRANCH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.