hi, i want to do a code review. i need to be able to get other people’s code, test it locally and give my observations. What part of the documentation explains this? I think I’ve seen it once, but I can’t find it, and I’ve been looking ever since.
Can anyone help me? Thank you.
The handling pull requests section of the contributing docs provide a great git alias for checking out a PR.
If you find yourself checking out pull requests locally more often, this git alias will be helpful:
[alias] pr = !sh -c \"git fetch upstream pull/${1}/head:pr/${1} && git checkout pr/${1}\"
Add it to your
~/.gitconfig
, and setupstream
to bedjango/django
. Then you can rungit pr ####
to checkout the corresponding pull request.
upstream
is whatever you named the remote for django/django
. I always call this origin
but YMMV
I think the gh
CLI also offers similar (but I don’t use it).
The slightly longer way is to add the contributors fork as a remote and then checkout the PR branch normally. (If you know the URL you can use that in the a get fetch
command instead of the upstream pull/.../head
bit in the command about. The help page for git fetch
goes into a lot of detail…)
Thanks carltongibson. I don’t know how you manage to find your way around all this documentation so easily.
Lot’s of practice
I know it feels like there’s a lot to begin with.
Lot’s of practice
yes, i’m gradually noticing it. tomorrow it’ll be our turn to say the same thing to a newcomer