Last active
August 29, 2015 14:00
-
-
Save JiriChara/11213670 to your computer and use it in GitHub Desktop.
Create fast pull request to OrganisedMinds from current branch
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 | |
require 'open3' | |
begin | |
stdout, status = Open3.capture2("git status -uno --porcelain") | |
rescue Errno::ENOENT | |
abort "Cannot run `git status -uno --porcelain`." | |
end | |
unless status.exitstatus == 0 | |
abort "git status failed - is this a git repository?" | |
end | |
branch, err = Open3.capture2('git symbolic-ref --short HEAD') | |
branch.strip! | |
user, err = Open3.capture2('git config github.user') | |
repo_name, err = Open3.capture2('basename `git rev-parse --show-toplevel`') | |
exec("google-chrome 'https://github.com/#{user}/#{repo_name}/compare/OrganisedMinds:#{branch}...#{user}:#{branch}'") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment