Created
March 17, 2013 11:56
-
-
Save maxehmookau/5181241 to your computer and use it in GitHub Desktop.
Make a pull request from your current branch in to the repo's master branch.
This file contains hidden or 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
def get_current_branch | |
b = `git branch`.split("\n").delete_if { |i| i[0] != "*" } | |
current_branch = b.first.split(" ").last | |
end | |
def get_origin_remote | |
`git remote -v`.split("\n").delete_if { |i| i[0..5] != 'origin' }.first | |
end | |
def get_github_username | |
get_origin_remote.split(':')[1].split('/').first | |
end | |
def get_repo_name | |
get_origin_remote.split('/')[1].split('.git').first | |
end | |
def get_pull_request_uri | |
"https://github.com/#{ get_github_username }/#{ get_repo_name }/pull/new/#{ get_github_username }:master...#{ get_github_username }:#{ get_current_branch }" | |
end | |
puts get_pull_request_uri |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment