Git submodules in sibling folder

Viewed 491

I like some of the features of git submodules. However, IntelliJ does not use them well. I just need a parent git repo that will point to a list of child repos that I use. I think IntelliJ will cooperate if all of the child repos are in sibling folders in the filesystem.

I tried this:

git submodule add me@myserver/child1.git ../child1

Got this:

The following path is ignored by one of your .gitignore files:
../child1 Use -f if you really want to add it.

Then I did this:

git submodule add -f me@myserver/child1.git ../child1

and got:

Cloning into '../child1'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
Checking connectivity... done.
fatal: Not a git repository: ../child1/../../.git/modules/../child1

Is there a way to add submodules as sibling folders?

1 Answers

Here the issue is not so much the "sibling" part, but the .gitignore part: you want to create a submodule folder in a parent folder test1 which is ignored.

Also make sure ../xxx is still part of your parent repo (and not "one folder" above the root folder of that repo).
The folder ../child1/../../.git/modules should exist.

A simpler process would be to go to the root folder to the main repo, and add from there:

cd /path/to/repo
git submodule add -f me@myserver/child1.git test1/child1
Related