Created
May 3, 2012 12:24
-
-
Save Sanne/2585309 to your computer and use it in GitHub Desktop.
Send a pull request from command line
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/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice stuff Sanne :)