#!/bin/bash # automagically clone with https://help.github.com/articles/checking-out-pull-requests-locally # since this is only going to work on GitHub anyway, don't make the user specify the full URL usage="Usage: $0 user/repo" path="${1:?$usage}" repo="$(basename "$path")" git clone git@github.com:${path} cd $repo sed -i $'/fetch = +refs/a \\\tfetch = +refs\/pull\/*\/head:refs\/remotes\/origin\/pr\/*' .git/config git remote update