How can I check out a pull request

Hello,
I want to check out the following pull request for testing:

The following approaches failed:

ufechner@TUD277255:~/repos/julia$ git checkout cf1226e55d033336f109ae0ffc06058e2f050d65
fatal: reference is not a tree: cf1226e55d033336f109ae0ffc06058e2f050d65
ufechner@TUD277255:~/repos/julia$ 
ufechner@TUD277255:~/repos/julia$ git checkout ib/time_include_topleveloverhead
error: pathspec 'ib/time_include_topleveloverhead' did not match any file(s) known to git.
ufechner@TUD277255:~/repos/julia$ 

How can I do this?

1 Like

This is described here:

The short version is to do

$ git fetch origin pull/39779/head:topleveloverhead

in your julia repository.
Then you can use
git checkout topleveloverhead
to go to the newly generated branch.

5 Likes

Thanks a lot for the detailed answer!

1 Like

But is this actually correct?

Because I want to get " IanButterworth:ib/time_include_topleveloverhead" . Is that the same as “topleveloverhead” ?

I also really enjoy the GitHub CLI for things like this. That lets you just write gh pr checkout 39779 to checkout the PR with the number 39779 in the upstream repo.

5 Likes

No, it is not the same but

tells git to create a new branch topleveloverhead in your local clone with the contents of pull/39779/head, which is how GitHub references PRs.

1 Like