Skip to content

Instantly share code, notes, and snippets.

@phstc
Last active May 20, 2019 13:15
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 phstc/9ba444079f3a21d893d6e82823f73e6d to your computer and use it in GitHub Desktop.
Save phstc/9ba444079f3a21d893d6e82823f73e6d to your computer and use it in GitHub Desktop.
Browse a GitHub pull request based on the branch name
  1. download gpr into ~/bin
  2. change org and repo in the script
  3. chmod +x ~/bin/gpr
  4. edit ~/.zshrc adding export PATH="$HOME/bin:$PATH"
  5. cd your-cloned-dir then gpr
#!/usr/bin/env ruby
branch = `git branch`.split("\n").map(&:strip).find { |branch| branch.start_with?('*') }.delete('* ')
# TODO: get the organization and repo based on `git remote -v`
url = "https://github.com/org/repo/pull/#{branch}"
`open "#{url}"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment