Skip to content

Instantly share code, notes, and snippets.

@spencerdcarlson
Last active August 7, 2018 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spencerdcarlson/417093547bca007a0e6cda210d8b18c0 to your computer and use it in GitHub Desktop.
Save spencerdcarlson/417093547bca007a0e6cda210d8b18c0 to your computer and use it in GitHub Desktop.
Shortcut to open the GitHub link to open a pull request (Mac)
#!/usr/bin/env ruby
url = `git config --get remote.origin.url`.chomp
if url.include? '@'
url = "https://#{url.sub(':','/').split('@')[1]}"
end
url.slice!('.git')
url += "/compare/#{ARGV[0]}...#{ARGV[1]}"
`open #{url}`
# HOW TO USE
# $ chmod +x git-pr # make executable
# $ mv git-pr /usr/local/bin # add to path
# $ git-pr master develop # open link to create a pull request from develop into master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment