Skip to content

Instantly share code, notes, and snippets.

@stefanooldeman
Created July 15, 2011 11:25
Show Gist options
  • Save stefanooldeman/1084518 to your computer and use it in GitHub Desktop.
Save stefanooldeman/1084518 to your computer and use it in GitHub Desktop.
push a branch and open the pull request screen

#gpush

push a branch and open the pull request screen in chrome with one script. please make your edits i'm sure this is still very cumbersome

todo:

note: allot of if cases are missing:

  • exit the scrit when git push' stdout is something like: "Already up to date."

tested on macosx

#!/bin/sh
gpush() {
branch=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
git push origin $branch
_url='https://github.com'
# add username
username=`git config -l | grep user.name | cut -d"=" -f2`
_url="$_url/$username"
# add current remote name
origin=`git remote -v | grep origin | grep push | cut -d"/" -f2 | cut -d"." -f1`
_url="$_url/$origin"
_url="$_url/pull/new/$branch"
open -a google\ chrome $_url
}
@stefanooldeman
Copy link
Author

Tip: check users default browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment