Skip to content

Instantly share code, notes, and snippets.

@kostia
Last active August 29, 2015 14:03
Show Gist options
  • Save kostia/b78a3c1a1c988e49335f to your computer and use it in GitHub Desktop.
Save kostia/b78a3c1a1c988e49335f to your computer and use it in GitHub Desktop.
Open Github-PR for a given SHA1 of a commit
#!/usr/bin/env bash
# Based on https://github.com/mhagger/git-when-merged.
# Usage: git open-pr <SHA1>
commit_sha1=`git when-merged $1|tr -s ' '|cut -d' ' -f2`
commit_pr_number=`git show $commit_sha1|grep 'Merge pull request'|cut -d'#' -f2|cut -d' ' -f1`
open "https://github.com/infopark/rails_connector/pull/$commit_pr_number"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment