Search code examples
gitvisual-studio-coderepositoryprojectsubdirectory

Track git changes in subfolders in VSCode


I have a project that has a root git repository that have multiple subfolders that are also git repositories. My structure is like this:

/Project
/Project/module/libs
/Project/module/src

Every folder has a separate git repository, because libs and src are used from another projects.

In root project I have ignored the others libs and src, but I want them to be tracked from the VSCode (Web Storm does it).


Solution

  • You should try and clone the main project elsewhere, then try and add the Git repos libs and src as submodule (assuming that those repos are already pushed somewhere)

    cd /path/to/Project
    git submodule add /url/repo/libs module/libs
    git submodule add /url/repo/src module/src
    

    Then you can open Project in VSCode: it should track as well libs and src.

    VSCode is still developing its Git submodule support, starting with PR 36313.