Created
April 4, 2016 20:54
-
-
Save ys/ad2be52913e65401840dbbe8261011cc to your computer and use it in GitHub Desktop.
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
#! /usr/bin/env ruby | |
issue= ARGV.shift | |
current_branch = `git rev-parse --abbrev-ref HEAD` | |
default_branch = ENV.fetch("DEFAULT_BRANCH", "master") | |
origin_url = `git config --get remote.origin.url` | |
if origin_url.start_with?("git") | |
repo = origin_url.split(':')[1].split('.')[0] | |
else | |
repo = origin_url.sub('https://github.com/', '').split('.')[0] | |
end | |
command = "gh pull-request" | |
command = command + " -i #{issue}" if issue | |
command = command + " -b #{repo}:#{default_branch} -h #{repo}:#{current_branch}" | |
system command |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment