# How can I check out a pull request

**URL:** <https://discourse.julialang.org/t/how-can-i-check-out-a-pull-request/55771>\
**Category:** Internals & Design\
**Tags:** question\
**Created:** [February 22, 2021, 11:03am UTC](https://discourse.julialang.org/t/how-can-i-check-out-a-pull-request/55771 "2021-02-22T11:03:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [February 22, 2021, 11:03am UTC](https://discourse.julialang.org/t/how-can-i-check-out-a-pull-request/55771/1 "2021-02-22T11:03:34Z")

</div>

Hello,  
I want to check out the following pull request for testing:  
[https://github.com/JuliaLang/julia/pull/39779](https://github.com/JuliaLang/julia/pull/39779)

The following approaches failed:

```julia
ufechner@TUD277255:~/repos/julia$ git checkout cf1226e55d033336f109ae0ffc06058e2f050d65
fatal: reference is not a tree: cf1226e55d033336f109ae0ffc06058e2f050d65
ufechner@TUD277255:~/repos/julia$ 

```

```nohighlight
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?

---

<div class="post-metadata">

**Author:** ![Fliks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fliks/32/2494_2.png) [@Fliks](https://discourse.julialang.org/u/Fliks)\
**Post date:** [February 22, 2021, 11:31am UTC](https://discourse.julialang.org/t/how-can-i-check-out-a-pull-request/55771/2 "2021-02-22T11:31:16Z")

</div>

This is described here:  
[https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/checking-out-pull-requests-locally](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/checking-out-pull-requests-locally)  
The short version is to do

```julia
$ 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.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [February 22, 2021, 11:35am UTC](https://discourse.julialang.org/t/how-can-i-check-out-a-pull-request/55771/3 "2021-02-22T11:35:03Z")

</div>

> [@Fliks](#):
>
> `git fetch origin pull/39779/head:topleveloverhead`

Thanks a lot for the detailed answer!

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [February 22, 2021, 11:39am UTC](https://discourse.julialang.org/t/how-can-i-check-out-a-pull-request/55771/4 "2021-02-22T11:39:27Z")

</div>

> [@Fliks](#):
>
> Then you can use  
> `git checkout topleveloverhead`  
> to go to the newly generated branch.

But is this actually correct?

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

---

<div class="post-metadata">

**Author:** ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Post date:** [February 22, 2021, 11:41am UTC](https://discourse.julialang.org/t/how-can-i-check-out-a-pull-request/55771/5 "2021-02-22T11:41:01Z")

</div>

I also really enjoy the [GitHub CLI](https://github.com/cli/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.

---

<div class="post-metadata">

**Author:** ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Post date:** [February 22, 2021, 11:50am UTC](https://discourse.julialang.org/t/how-can-i-check-out-a-pull-request/55771/6 "2021-02-22T11:50:11Z")

</div>

> [@ufechner7](#):
>
> Because I want to get " `IanButterworth:ib/time_include_topleveloverhead` " . Is that the same as “topleveloverhead” ?

No, it is not the same but

> [@Fliks](#):
>
> `$ git fetch origin pull/39779/head:topleveloverhead`

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.
