From f9ffcfa0ed6cbfb727f5cdb76a64381b1d1026df Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Wed, 25 Mar 2015 16:14:53 -0700 Subject: [PATCH] tighten up the git pr alias --- git/githelpers | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/git/githelpers b/git/githelpers index c71376c..01d55fb 100644 --- a/git/githelpers +++ b/git/githelpers @@ -67,10 +67,18 @@ update_branch() { } get_pr() { + PR=$1 REMOTE=$2 - : ${REMOTE:="upstream"} - git fetch ${REMOTE} pull/${1}/head:pr/${1} - git checkout pr/${1} + : ${REMOTE:=$DEFAULT_REMOTE} + + if [ -z "$PR" ]; then + echo "Please specify a PR to checkout" + exit 1 + fi + + echo Checking out PR ${PR} from ${REMOTE} + git fetch ${REMOTE} pull/${PR}/head:pr/${PR} + git checkout pr/${PR} } del_pr() {