Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate.
Git Submodules
Keep another Git repository as a subdirectory of your main project.
Key Takeaways: Git Submodules
Mastering Git Submodules helps you write clean and reliable Git code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
Git Submodules Code Example
Gitgit submodule add https://github.com/example/shared-ui.git libs/shared-ui
git submodule update --init --recursive
Output
Clones and links nested submodule repository
Run this example on your own computer. The "Get Started" lesson shows how to set it up.
Finished this lesson?
Mark it complete to track your progress.
Stuck on something?
Ask the community in the CodesInTech forum.
Need a developer?
Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.
Explore Our Services