# Easiest way to pkg add a pull request?

**URL:** <https://discourse.julialang.org/t/easiest-way-to-pkg-add-a-pull-request/76755>\
**Category:** General Usage\
**Tags:** question, pkg\
**Created:** [February 19, 2022, 3:04pm UTC](https://discourse.julialang.org/t/easiest-way-to-pkg-add-a-pull-request/76755 "2022-02-19T15:04:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [February 19, 2022, 3:04pm UTC](https://discourse.julialang.org/t/easiest-way-to-pkg-add-a-pull-request/76755/1 "2022-02-19T15:04:27Z")

</div>

What is the fastest way to `] add` a pull request of a package? For example, if someone has contributed a fix to a package that I want to quickly test out, but that has not yet been merged.

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [February 19, 2022, 4:21pm UTC](https://discourse.julialang.org/t/easiest-way-to-pkg-add-a-pull-request/76755/2 "2022-02-19T16:21:40Z")

</div>

I typically `] dev --local` the package and then use GitHubs `gh` tool to checkout the pr.

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [February 20, 2022, 12:35pm UTC](https://discourse.julialang.org/t/easiest-way-to-pkg-add-a-pull-request/76755/3 "2022-02-20T12:35:21Z")

</div>

I was hoping for something within pkg

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [February 20, 2022, 12:40pm UTC](https://discourse.julialang.org/t/easiest-way-to-pkg-add-a-pull-request/76755/4 "2022-02-20T12:40:56Z")

</div>

`pkg> add ${URL}#${BRANCH}`.

---

<div class="post-metadata">

**Author:** ![rikh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rikh/32/204104_2.png) [@rikh](https://discourse.julialang.org/u/rikh)\
**Post date:** [February 20, 2022, 1:21pm UTC](https://discourse.julialang.org/t/easiest-way-to-pkg-add-a-pull-request/76755/5 "2022-02-20T13:21:36Z")

</div>

On a funny side-note, I recently saw

```nohighlight
run: julia --color=yes --project -e 'using Pkg; Pkg.instantiate();
    using Foo#master; Foo.build()'

```

in a GitHub Action. This code looks valid if you don’t pay much attention and it will run in an Action, but it does not call `Foo.build` 😂

(This is not an issue or whatever. The pkg API is great. It’s just funny.)

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [February 20, 2022, 1:40pm UTC](https://discourse.julialang.org/t/easiest-way-to-pkg-add-a-pull-request/76755/6 "2022-02-20T13:40:04Z")

</div>

Yes I know how to pull a branch, but that isn’t necessarily the same as a pull request, yea?

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [February 20, 2022, 1:56pm UTC](https://discourse.julialang.org/t/easiest-way-to-pkg-add-a-pull-request/76755/7 "2022-02-20T13:56:14Z")

</div>

Well, I guess it is. The PR is a branch at a forked repo.

---

<div class="post-metadata">

**Author:** ![rikh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rikh/32/204104_2.png) [@rikh](https://discourse.julialang.org/u/rikh)\
**Post date:** [February 20, 2022, 1:58pm UTC](https://discourse.julialang.org/t/easiest-way-to-pkg-add-a-pull-request/76755/8 "2022-02-20T13:58:58Z")

</div>

Maybe Fredrik knows an even better way, but you can copy the link from the top of the PR and modify it slightly to pass to Pkg. For example, [Update WebServer.jl by Moelf · Pull Request #1933 · fonsp/Pluto.jl · GitHub](https://github.com/fonsp/Pluto.jl/pull/1933) has

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/6/36c6423f5d45b5c27551eaf2e403b42a83b39a2a.png)

If you copy the link from “Moelf:patch-4”, you get [https://github.com/Moelf/Pluto.jl/tree/patch-4](https://github.com/Moelf/Pluto.jl/tree/patch-4).

Now, replacing `/tree/` by `#` will work in the package manager:

```sh
pkg> add https://github.com/Moelf/Pluto.jl#patch-4

```

This method works for forks and for PRs from within the original repo.

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [February 26, 2022, 2:25pm UTC](https://discourse.julialang.org/t/easiest-way-to-pkg-add-a-pull-request/76755/9 "2022-02-26T14:25:08Z")

</div>

This question was just borne out of a silly misunderstanding. I was worried about the PR and the branch it is based on becoming out of sync, but that can’t really happen. I guess I just don’t use PRs enough to know how they work — I commit to `main` 😆 YOLO

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [November 1, 2023, 4:05pm UTC](https://discourse.julialang.org/t/easiest-way-to-pkg-add-a-pull-request/76755/10 "2023-11-01T16:05:35Z")

</div>

i was having a hard time figuring out the branch name for a github pull request, so i used the commit hash instead. like this:

```julia
add https://github.com/JuliaLang/PackageCompiler.jl#153c30f4d191bb54ae9afa6483c69c9842774484

```

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [November 1, 2023, 4:16pm UTC](https://discourse.julialang.org/t/easiest-way-to-pkg-add-a-pull-request/76755/11 "2023-11-01T16:16:53Z")

</div>

> [@bjarthur](#):
>
> ```julia
> add https://github.com/JuliaLang/PackageCompiler.jl#153c30f4d191bb54ae9afa6483c69c9842774484
> 
> ```

Part of the issue is that commit has no branch at that repository. It is located at @sloede 's fork at [https://github.com/sloede/PackageCompiler.jl/tree/msl/bundle-libexec](https://github.com/sloede/PackageCompiler.jl/tree/msl/bundle-libexec)

So the command would have been the following.

```julia
] add https://github.com/sloede/PackageCompiler.jl#msl/bundle-libexec

```

You can see this information at the top of the pull request:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/0/f033aeac1ab26e8faf3b83594958e42ea5135189.png)
