Last active
August 29, 2015 14:00
-
-
Save msakrejda/3a689c89e6b0edfd3ef1 to your computer and use it in GitHub Desktop.
automagic GitHub pull requests as remote branches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment