Skip to content

Instantly share code, notes, and snippets.

@bennovakovic
Created March 10, 2016 01:23
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 bennovakovic/ad1b246a32b1963cb7bb to your computer and use it in GitHub Desktop.
Save bennovakovic/ad1b246a32b1963cb7bb to your computer and use it in GitHub Desktop.
Quickly the github PR review page from the current branch
#!/bin/bash
# Running with no arguments opens against release,
# but pass one argument to open against that branch:
# $ git-pr master
# $ git-pr
MAIN_BRANCH='release'
if [ -n "$1" ]; then
MAIN_BRANCH=$1
fi
CURRENT_BRANCH=`git branch 2>/dev/null | grep '*' | sed 's/* \(.*\)/\1/'`
URL=`git remote -v 2> /dev/null | grep '(push)' | awk '{print $2}'`
if [ -n "$URL" ]; then
URL="$URL/compare/$MAIN_BRANCH...$CURRENT_BRANCH"
open $URL
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment