Skip to content

Instantly share code, notes, and snippets.

@jedgell
Created November 5, 2014 18:51
Show Gist options
  • Save jedgell/c3c9e882c46932c76335 to your computer and use it in GitHub Desktop.
Save jedgell/c3c9e882c46932c76335 to your computer and use it in GitHub Desktop.
Check out the result of a pending pull request

So, this makes doing code review much easier for me, and I just thought I'd share with the world.

Repository .git/config Changes

Always put the original system generated fetch refs map last. Always!

The remotes below refer to the "blessed repo". More, specifically, the destination repository of the pull request, but the same concept can be used if you're accepting pull requests on your "personal" repository, as well.

Stash

$ cd /path/to/repo
$ git config remote.[remote name].fetch +refs/pull-requests/*:refs/remotes/[remote name]/pull-requests/*
$ nano .git/config

[remote "[remote name]"]
    url = ssh://[email protected]/~user/repository.git
    fetch = +refs/pull-requests/*:refs/remotes/[remote name]/pull-requests/*
    fetch = +refs/heads/*:refs/remotes/[remote name]/*

Github

$ cd /path/to/repo
$ git config remote.[remote name].fetch +refs/pull/*:refs/remotes/[remote name]/pull-requests/*
$ nano .git/config

[remote "[remote name]"]
    url = [email protected]:joyent/node.git
    fetch = +refs/pull/*:refs/remotes/[remote name]/pull-requests/*
    fetch = +refs/heads/*:refs/remotes/[remote name]/*

References:

Stash

GitHub

Additional reading:

So, you've gone and messed up and didn't do that thing I told you to do about putting the system generated refs map last, and decided that you're not going to do it, even now that you're getting this colorful message about "diff.realname" variable being set too low; oh, and also, your syslog is getting spammed with messages about too many open files? I feel bad for you, son. Here's a link on how to band-aid that problem, until you come to your senses and just do what I told you to do, in the first place.

You'll eventually run into other fun errors like not being able to push changes to branches and not be able to make commits to local branches because reference names don't resolve, but don't worry - I'm sure that'll all work itself out. Or, you could just put the stupid system generated fetch reference where it belongs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment