Skip to content

Instantly share code, notes, and snippets.

@humidair1999
Created April 9, 2015 18:37
Show Gist options
  • Save humidair1999/0ecdca1519282e1f7b36 to your computer and use it in GitHub Desktop.
Save humidair1999/0ecdca1519282e1f7b36 to your computer and use it in GitHub Desktop.
Add pull request repos to a cloned repo directory easily
function add_pr_remotes() {
mv .git/config .git/config-orig
awk '/remote "origin"/ {
print $0
getline;
print $0
getline;
print $0
print "\tfetch = +refs/pull/*/head:refs/remotes/origin/pr/*"
}1' .git/config-orig > .git/config
git fetch origin
}
# After that you can `gco pr/2` to review the code in pr2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment