# How to switch to a different branch in new Pkg?

**URL:** <https://discourse.julialang.org/t/how-to-switch-to-a-different-branch-in-new-pkg/11567>\
**Category:** New to Julia\
**Tags:** package\
**Created:** [June 10, 2018, 8:20pm UTC](https://discourse.julialang.org/t/how-to-switch-to-a-different-branch-in-new-pkg/11567 "2018-06-10T20:20:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [June 10, 2018, 8:20pm UTC](https://discourse.julialang.org/t/how-to-switch-to-a-different-branch-in-new-pkg/11567/1 "2018-06-10T20:20:16Z")

</div>

I am trying to start updating my packages to 0.7, but I want to still be able to compare them to the 0.6 versions to detect regressions etc. **This means that I want to have the same local git repo for both Julia versions**.

I thought I figured it out, and the answer was simply using `#`. This is what I did, in Julia 0.7:

```julia
(v0.7) pkg> status
    Status `C:\Users\datseris\.julia\environments\v0.7\Project.toml`
  [189a3867] Reexport v0.1.0
  [ae029012] Requires v0.4.3
  [90137ffa] StaticArrays v0.7.0

(v0.7) pkg> add C:\Users\datseris\.julia\v0.6\DynamicalBilliards#0.7
  Updating git-repo `C:\Users\datseris\.julia\v0.6\DynamicalBilliards`
┌ Warning: packages will require to have a [Julia]Project.toml file in the future
└ @ Pkg.Types Types.jl:817
  Updating registry at `C:\Users\datseris\.julia\registries\Uncurated`
  Updating git-repo `https://github.com/JuliaRegistries/Uncurated.git`
 Resolving package versions...
  Updating `C:\Users\datseris\.julia\environments\v0.7\Project.toml`
  [4986ee89] + DynamicalBilliards v1.6.3+ #0.7 [C:\Users\datseris\.julia\v0.6\DynamicalBilliards]
  Updating `C:\Users\datseris\.julia\environments\v0.7\Manifest.toml`
  [4986ee89] + DynamicalBilliards v1.6.3+ #0.7 [C:\Users\datseris\.julia\v0.6\DynamicalBilliards]
  [1914dd2f] + MacroTools v0.4.1
  [9602ed7d] + Unrolled v0.0.2

```

This already shows that something went wrong. In the `0.7` branch, which I believed I tagged out, there is no `Unrolled` package in the `REQUIRE` file, or in the source code.

Now here comes the actual big problem. When doing

```julia
julia> using DynamicalBilliards
[ Info: Precompiling module DynamicalBilliards
┌ Warning: Deprecated syntax `(loopbody...)` at C:\Users\datseris\.julia\packages\Unrolled\eA4l\src\Unrolled.jl:33.
│ Use `(loopbody...,)` instead.
└ @ nothing Unrolled.jl:33
ERROR: LoadError: syntax: expected ")"
...
...
...

```

Julia tries to load `Unrolled`, which _definitely_ does not correspond with the source code in the `0.7` branch that I have hoped to have checked-out to.

So, how do I do it?

---

<div class="post-metadata">

**Author:** ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)\
**Post date:** [June 10, 2018, 9:53pm UTC](https://discourse.julialang.org/t/how-to-switch-to-a-different-branch-in-new-pkg/11567/2 "2018-06-10T21:53:40Z")

</div>

I encountered similar problems with local (unregistered) packages - the requested commit was not actually checked out. There is [a related issue for `Pkg`](https://github.com/JuliaLang/Pkg.jl/issues/328).

To quote @kristoffer.carlsson in that issue,

> The package manager is not a full git client. Just go to [your local repo] and do whatever git operations you want.

Also, I think you probably want `pkg> develop` rather than `pkg> add` for this situation.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [June 11, 2018, 6:26am UTC](https://discourse.julialang.org/t/how-to-switch-to-a-different-branch-in-new-pkg/11567/3 "2018-06-11T06:26:36Z")

</div>

`add` is for when you want to track a remote or local repo (e.g a branch). This requires you to `update` to pull the latest commits on that branch. `develop` is for when you want to track a certain path.

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [June 11, 2018, 3:55pm UTC](https://discourse.julialang.org/t/how-to-switch-to-a-different-branch-in-new-pkg/11567/4 "2018-06-11T15:55:12Z")

</div>

Thanks both. The answer is indeed to use `pkg> develop C:\Users\datseris\.julia\v0.6\DynamicalBilliards#0.7` instead of `add`
