For this, I have the following refspec in my projects' .git/config under [remote "origin"]:
fetch = +refs/pull/*/head:refs/pull/*
That way, whenever I git fetch, I have all of the PR commits under refs/pull/*, so if I want to try out the code for PR 123, I just need to git checkout pull/123 and go from there. You could also do something like +refs/pull/*/merge:refs/pr-merges/* if you want to check against the commits merging into the target branch, too!
Yes - I should have mentioned this is specific to GitHub! I don't know if other hosting platforms implement PRs the same way (ie. refs on the main repo), but if they do (or to find out if they do), you can do git ls-remote origin to list all of the refs on the remote and see if any pattern emerges from the output.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
For this, I have the following refspec in my projects'
.git/config
under[remote "origin"]
:That way, whenever I
git fetch
, I have all of the PR commits underrefs/pull/*
, so if I want to try out the code for PR 123, I just need togit checkout pull/123
and go from there. You could also do something like+refs/pull/*/merge:refs/pr-merges/*
if you want to check against the commits merging into the target branch, too!Is this assuming that the remote is Github?
Yes - I should have mentioned this is specific to GitHub! I don't know if other hosting platforms implement PRs the same way (ie. refs on the main repo), but if they do (or to find out if they do), you can do
git ls-remote origin
to list all of the refs on the remote and see if any pattern emerges from the output.