# Is it possible to have submodules deep in subfolders?

**URL:** <https://forum.sublimetext.com/t/is-it-possible-to-have-submodules-deep-in-subfolders/59358>\
**Category:** Sublime Merge\
**Created:** [June 30, 2021, 7:40pm UTC](https://forum.sublimetext.com/t/is-it-possible-to-have-submodules-deep-in-subfolders/59358 "2021-06-30T19:40:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Satoshi-Yoda](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/satoshi-yoda/32/73275_2.png) [@Satoshi-Yoda](https://forum.sublimetext.com/u/Satoshi-Yoda)\
**Post date:** [June 30, 2021, 7:40pm UTC](https://forum.sublimetext.com/t/is-it-possible-to-have-submodules-deep-in-subfolders/59358/1 "2021-06-30T19:40:48Z")

</div>

Good day! 🤠

Is there a way to maintain submodules deep down in the tree? And not in the top folder?  
I found this question:

> [@Is there a way to add a submodule in a subfolder?](https://forum.sublimetext.com/t/is-there-a-way-to-add-a-submodule-in-a-subfolder/44073):
>
> I don’t see any way of adding a submodule in a subfolder of the repo instead of at the root. “The name that will be stored in the .gitsubmodules file” does not impact the location of the repo.

Apologies for creating similar topic, but this was 2 years ago, maybe something changed in that time…  
And my question is not only “Can I do it with SM interface?”  
It is also “Can I init that with custom git commands, or copy-rename-edit, or something, and then maintain it with SM?”

And can I clone projects that already contain submodules deep in the tree?

---

<div class="post-metadata">

**Author:** ![jkhoriaty](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jkhoriaty](https://forum.sublimetext.com/u/jkhoriaty)\
**Post date:** [September 15, 2021, 6:17pm UTC](https://forum.sublimetext.com/t/is-it-possible-to-have-submodules-deep-in-subfolders/59358/2 "2021-09-15T18:17:03Z")

</div>

My workaround was to add the command myself to the `Default.sublime-commands` file in the Data/Packages/User directory of the installation folder. The command I added:

> {  
> “caption”: “Add submodule at path”,  
> “command”: “git”,  
> “args”: { “argv”: [“submodule”, “add”, “$text”, “$text”] }  
> },

The first $text parameter is the url of the submodule and the second $text parameter is the relative path of the directory to which you want to add the submodule. Hope it helps!
