Skip to content

Instantly share code, notes, and snippets.

@OneOfOne
Created March 9, 2016 21:26
Show Gist options
  • Select an option

  • Save OneOfOne/8bf446750d24ea084144 to your computer and use it in GitHub Desktop.

Select an option

Save OneOfOne/8bf446750d24ea084144 to your computer and use it in GitHub Desktop.
git push-new: pushes a new branch to remote and creates a pull request (uses hub)
#!/bin/sh
BRANCH=$(git symbolic-ref --short HEAD)
if echo $BRANCH | grep -q master; then
echo no master pushing
exit 1
fi
if git remote show -n origin | grep -q $BRANCH; then
git push "$@"
else
echo creating new branch
git push --set-upstream origin $BRANCH "$@"
fi
hub pull-request -o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment