Julia:如何更改包的分支
Julia: How to change a package's branch
我正在尝试更改我用于从 Github 获得的包的分支。 (我不想使用 master。)我试过 using Pkg
,然后 Pkg.checkout("Package","branchIwant")
,但它作为未定义的函数返回....我假设该函数已被弃用。我最初是通过在包管理器中使用 add PackageIWant
添加包的(当 REPL 从终端启动时按 ]
)。当我导航到 .julia/packages/PackageIWant
下的包并尝试使用 Git 更改分支时,它说它不是 Git 存储库。
有什么建议吗?
朱莉娅 v1.3.0.
MacOS - 虽然这不重要
这在Pkg.jl docs中有解释:
If a branch (or a certain commit) of Example has a hotfix that is not yet included in a registered version, we can explicitly track that branch (or commit) by appending #branchname (or #commitSHA1) to the package name:
(v1.0) pkg> add Example#master
Updating git-repo `https://github.com/JuliaLang/Example.jl.git`
Resolving package versions...
Updating `~/.julia/environments/v1.0/Project.toml`
[7876af07] ~ Example v0.5.1 ⇒ v0.5.1+ #master (https://github.com/JuliaLang/Example.jl.git)
Updating `~/.julia/environments/v1.0/Manifest.toml`
[7876af07] ~ Example v0.5.1 ⇒ v0.5.1+ #master (https://github.com/JuliaLang/Example.jl.git)
The status output now shows that we are tracking the master branch of Example. When updating packages, we will pull updates from that branch.
我找到了解决方法:
不要通过 add gitrepogttps
添加包,而是使用 dev gitrepohttps
。这会将包放入您的开发文件夹 (../.julia/dev/packageinquestion
)。然后你可以导航到分支并使用git切换分支。
请注意,这不像上面的答案那么巧妙。
我正在尝试更改我用于从 Github 获得的包的分支。 (我不想使用 master。)我试过 using Pkg
,然后 Pkg.checkout("Package","branchIwant")
,但它作为未定义的函数返回....我假设该函数已被弃用。我最初是通过在包管理器中使用 add PackageIWant
添加包的(当 REPL 从终端启动时按 ]
)。当我导航到 .julia/packages/PackageIWant
下的包并尝试使用 Git 更改分支时,它说它不是 Git 存储库。
有什么建议吗?
朱莉娅 v1.3.0.
MacOS - 虽然这不重要
这在Pkg.jl docs中有解释:
If a branch (or a certain commit) of Example has a hotfix that is not yet included in a registered version, we can explicitly track that branch (or commit) by appending #branchname (or #commitSHA1) to the package name:
(v1.0) pkg> add Example#master
Updating git-repo `https://github.com/JuliaLang/Example.jl.git`
Resolving package versions...
Updating `~/.julia/environments/v1.0/Project.toml`
[7876af07] ~ Example v0.5.1 ⇒ v0.5.1+ #master (https://github.com/JuliaLang/Example.jl.git)
Updating `~/.julia/environments/v1.0/Manifest.toml`
[7876af07] ~ Example v0.5.1 ⇒ v0.5.1+ #master (https://github.com/JuliaLang/Example.jl.git)
The status output now shows that we are tracking the master branch of Example. When updating packages, we will pull updates from that branch.
我找到了解决方法:
不要通过 add gitrepogttps
添加包,而是使用 dev gitrepohttps
。这会将包放入您的开发文件夹 (../.julia/dev/packageinquestion
)。然后你可以导航到分支并使用git切换分支。
请注意,这不像上面的答案那么巧妙。