Tom
Tom

Reputation: 136

Using Julia packages from a Fork

I'm currently working on a project which involves the modification of an existing Julia package.

I have set up my own fork of the package on github and was wondering if it is possible to use this instead of the version on the Julia repository. I know it is possible to force Julia to use a specific package version using Pkg.pin() but i'm not sure how to force it to use my fork.

Upvotes: 2

Views: 625

Answers (2)

mdavezac
mdavezac

Reputation: 515

You can also clone directly from your fork:

Pkg.clone("https://www.github.com/youusername/yourrepo")

You may need to first delete the current version with Pkg.rm.

Upvotes: -1

Chris Rackauckas
Chris Rackauckas

Reputation: 19162

Pkg cannot handle different remotes, but git can. Just add your fork as a separate remote in git, and switch branches.

Example. By default, Pkg.add("MyPackage") will add the original package under the remote origin, with its master branch as origin/master. So lets say we want to add the remote MyFork. Then:

git remote add MyFork URL

adds this. Now you can

git checkout MyFork/mybranch

work on that, do all your gitty stuff, and then go back with

git checkout origin/branch_on_origin

I find it is much easier to use GitKraken than straight git though. It's a nice GUI that will handle multiple remotes well. Github Desktop will not handle multiple remotes well.

Upvotes: 4

Related Questions