DEV Community

chanon-mike
chanon-mike

Posted on

Add local git repository submodule

When there are a submodule inside the folder and it is not a remote repository.

.
├── submodule
│   └── submodule.md
└── test.md
Enter fullscreen mode Exit fullscreen mode

Inside this root directory, there are a submodule repo.
You can add it by

git submodule add git:submodule submodule             
Enter fullscreen mode Exit fullscreen mode

Then .gitmodules will be created at root directory, and here is the content

[submodule "submodule"]
    path = submodule
    url = git:submodule
Enter fullscreen mode Exit fullscreen mode

Top comments (0)