# Local package in git submodule

**URL:** https://discourse.julialang.org/t/local-package-in-git-submodule/55530
**Category:** General Usage
**Tags:** package, git
**Created:** [February 18, 2021, 10:00am UTC](https://discourse.julialang.org/t/local-package-in-git-submodule/55530 "2021-02-18T10:00:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![andrekal](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@andrekal](https://discourse.julialang.org/u/andrekal)
#### Post date: [February 18, 2021, 10:00am UTC](https://discourse.julialang.org/t/local-package-in-git-submodule/55530/1 "2021-02-18T10:00:32Z")

</div>

Hi,  
I am working on a project in which I develop a couple of different packages (and also keep a fork of a public package). I wanted to use git sub-modules to keep that in check. Specifically the tree looks something like

```julia
Project
├── .git [FOLDER]
├── .gitmodules
├── Manifest.toml
├── Project.toml
├── data
├── scripts
│ └── script.jl
└── src
    ├── Package1
    │ ├── .git [FILE]
    │ ├── Project.toml
    │ └── src
    │ └── Package1.jl
    └── Package2 
        ├── .git [FILE]
        ├── Project.toml
        └── src
            └── Package2.jl

```

Unfortunately I cannot ]add src/Package1 since it’s not a git repo but a git submodule:

```julia
(Project) pkg> add src/Package1
ERROR: Did not find a git repository at `src/Package1`

```

I could add the remote but that would decouple the commits of the Packages and those of the Project using them which is the exact reason I was trying to do this. Also, that seems overly complicated to be honest.

Is there a solution to this, either from the Julia side or the Git side?

Also, if I’m doing something that should not be done and there is a better way, I don’t mind changing since right now my project is fairly easy to manage and can be switched to another format.

Best regards

---

<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 18, 2021, 10:45am UTC](https://discourse.julialang.org/t/local-package-in-git-submodule/55530/2 "2021-02-18T10:45:41Z")

</div>

The easiest is probably to use `dev src/Package1` which would point to that local file path. The second option would be to use `add` with a subdirectory: `add .:src/Package1`. Note that they have slight differences: `dev` uses the current state on the file system while `add` uses the content of the last commit.

---

<div class="post-metadata">

### Author: ![andrekal](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@andrekal](https://discourse.julialang.org/u/andrekal)
#### Post date: [February 18, 2021, 10:52am UTC](https://discourse.julialang.org/t/local-package-in-git-submodule/55530/3 "2021-02-18T10:52:03Z")

</div>

Wow, thank you so much, this is perfect!  
And thank you for both suggestions, both will come in extremely handy.
