# How to contribute to existing package

**URL:** <https://discourse.julialang.org/t/how-to-contribute-to-existing-package/32749>\
**Category:** General Usage\
**Created:** [December 28, 2019, 3:23am UTC](https://discourse.julialang.org/t/how-to-contribute-to-existing-package/32749 "2019-12-28T03:23:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuxi.liu](https://avatars.discourse-cdn.com/v4/letter/y/839c29/32.png) [@yuxi.liu](https://discourse.julialang.org/u/yuxi.liu)\
**Post date:** [December 28, 2019, 3:23am UTC](https://discourse.julialang.org/t/how-to-contribute-to-existing-package/32749/1 "2019-12-28T03:23:26Z")

</div>

How to develop existing packages? If I want to develop `Example.jl`, should I use pkg and

```julia
pkg> develop --local Example

```

or fork the repo and then clone to desktop? If so, how do I load my local copy of package to Julia? How do I run tests?

Right now I think I would do the following:

1. Fork the repo on GitHub.
2. Clone the forked repo to my desktop.
3. Somehow make my Julia REPL recognize the clone of the forked repo on desktop as the correct package to run.
4. Code in Juno and test in REPL.
5. Push to my forked repo.
6. Open pull request.

Past 3 is a complete mystery to me.

---

<div class="post-metadata">

**Author:** ![00vareladavid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00vareladavid/32/23521_2.png) [@00vareladavid](https://discourse.julialang.org/u/00vareladavid)\
**Post date:** [December 28, 2019, 3:31am UTC](https://discourse.julialang.org/t/how-to-contribute-to-existing-package/32749/2 "2019-12-28T03:31:20Z")

</div>

If you have already git cloned the package, you can avoid `develop` and directly activate the package.

Assuming you just did `$ git clone https://github.com/MyUser/SomePackage.jl`, you can either use the `--project` startup flag:

```julia
$ cd SomePackage.jl
$ julia --project
julia> import SomePackage

```

Or use `activate`:

```julia
$ julia
pkg> activate ./SomePackage.jl
julia> import SomePackage

```

---

<div class="post-metadata">

**Author:** ![yuxi.liu](https://avatars.discourse-cdn.com/v4/letter/y/839c29/32.png) [@yuxi.liu](https://discourse.julialang.org/u/yuxi.liu)\
**Post date:** [December 28, 2019, 4:26am UTC](https://discourse.julialang.org/t/how-to-contribute-to-existing-package/32749/3 "2019-12-28T04:26:17Z")

</div>

How would one use `pkg> dev` for creating forks and making pull requests?

---

<div class="post-metadata">

**Author:** ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)\
**Post date:** [December 28, 2019, 6:26am UTC](https://discourse.julialang.org/t/how-to-contribute-to-existing-package/32749/4 "2019-12-28T06:26:31Z")

</div>

I don’t think the order of 1 and 2 matters.

1. `pkg> develop Example`  
(Example package is in dir ~/.julia/dev)

2. fork repo on github

3. 
  - go to ~/.julia/dev/Example and use git:  
`git remote -v` (origin should be pointing to where the package is from)  
add a new remote pointing to your fork:  
`git remote add myfork https://github.com/yourname/reponame`

4. myfork can be any name

5. `git push myfork`

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 28, 2019, 6:27am UTC](https://discourse.julialang.org/t/how-to-contribute-to-existing-package/32749/5 "2019-12-28T06:27:39Z")

</div>

You can

```julia
pkg> dev SomeRegisteredPackage

```

but then you need to fork, and add the forked repository as a remote:

[https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes)

Alternatively, you can

```julia
pkg> dev forked-repository-url

```

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 28, 2019, 6:27am UTC](https://discourse.julialang.org/t/how-to-contribute-to-existing-package/32749/6 "2019-12-28T06:27:55Z")

</div>

I do an example start to finish in this video:

[![](https://global.discourse-cdn.com/julialang/original/3X/a/9/a9eed041bdd2be4339d3e6dd3961b86bdc1511f3.jpeg "Developing Julia Packages") ](https://www.youtube.com/watch?v=QVmU29rCjaA)

First developing a new package, then making a PR to an existing package.

---

<div class="post-metadata">

**Author:** ![yuxi.liu](https://avatars.discourse-cdn.com/v4/letter/y/839c29/32.png) [@yuxi.liu](https://discourse.julialang.org/u/yuxi.liu)\
**Post date:** [December 29, 2019, 11:22am UTC](https://discourse.julialang.org/t/how-to-contribute-to-existing-package/32749/7 "2019-12-29T11:22:48Z")

</div>

This is what I did in the end:

1. Use `pkg > dev Example`
2. Fork on GitHub (steps 1 and 2 can be exchanged)
3. Go to the folder that looks like `~/.julia/dev/Example` and open a git terminal there, and add my GitHub fork repo as its “remote origin”.Optionally add the original GitHub repo as “remote upstream”.
4. Develop on my desktop.
5. Push to my GitHub repo
6. Open pull request on original GitHub repo
