Skip to content

Instantly share code, notes, and snippets.

@Sanne
Created May 3, 2012 12:24
Show Gist options
  • Save Sanne/2585309 to your computer and use it in GitHub Desktop.
Save Sanne/2585309 to your computer and use it in GitHub Desktop.
Send a pull request from command line
#!/bin/bash
# Released under the WTFPL license version 2 http://sam.zoy.org/wtfpl/
#
# Copyright (c) 2012 Sanne Grinovero
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/"
}
function git_project_id {
git remote --verbose 2>/dev/null | grep origin | sed -e "s/origin\(.*\)[email protected]:\(.*\)\.git.*/\2/" | uniq -d
}
BRANCH=$(parse_git_branch)
PROJ=$(git_project_id)
URL=https://github.com/$PROJ/pull/new/$BRANCH
echo Prepare pull request $BRANCH to $URL
git push origin $BRANCH
xdg-open $URL
@bartoszmajsak
Copy link

Nice stuff Sanne :)

@Sanne
Copy link
Author

Sanne commented May 3, 2012

@bartoszmajsak, thanks! how did you find this?

@bartoszmajsak
Copy link

I'm spying on you :)

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