Skip to content

Instantly share code, notes, and snippets.

@JiriChara
Last active August 29, 2015 14:00
Show Gist options
  • Save JiriChara/11213670 to your computer and use it in GitHub Desktop.
Save JiriChara/11213670 to your computer and use it in GitHub Desktop.
Create fast pull request to OrganisedMinds from current branch
#!/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