Last Updated: February 25, 2016
·
452
· finack

Checkout github pull request branch

Here is quick zsh method to checkout a pull request by number

cd project
gcop 3

Add this to your zsh configs

gcop() {
   git ls-remote --exit-code origin refs/pull/$1/merge
   [ $? -ne 0 ] && echo "Could not find pull request $1" && return
   git fetch origin +refs/pull/$1/merge
   git checkout FETCH_HEAD
 }