Skip to content

Instantly share code, notes, and snippets.

@jbarrett
Created February 22, 2019 11:43
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 jbarrett/3e98c6742641eaca456aece62bd9d809 to your computer and use it in GitHub Desktop.
Save jbarrett/3e98c6742641eaca456aece62bd9d809 to your computer and use it in GitHub Desktop.
Git command : checkout PR
#!/usr/bin/env bash
[ -z "$1" ] && echo PR number required. && exit 1
BRANCHNAME=pr$1
[ ! -z "$2" ] && BRANCHNAME=$2
git fetch origin pull/$1/head:$BRANCHNAME
git checkout $BRANCHNAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment