DEV Community

Cover image for Git Tools - Submodules
Hamed0406
Hamed0406

Posted on

2 1

Git Tools - Submodules

What is Submodules and why developer need it ?

Git Tools - Submodules is tools to let developer have a child repository under a parent repository .

in other words as git official document said :
"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." [1]

configuration file for Git-Submodules is ".gitmodules" .
The new submodule can be added by this command :

git submodule add the absolute or relative URL of the project

for example :

git submodule add https://gitlab.com/Hamed0406/springboot-dashboed
after running the command this lines will be added to

[submodule "springboot-dashboed"]
    path = springboot-dashboed
    url = https://gitlab.com/Hamed0406/springboot-dashboed

Enter fullscreen mode Exit fullscreen mode

to .gitmodules file.

Note : if you have private repo as submodules and share your project with others, you have to be sure they have access to the private repo.

References

  1. git-scm.com , [https://git-scm.com/book/en/v2/Git-Tools-Submodules]

SurveyJS custom survey software

Simplify data collection in your JS app with a fully integrated form management platform. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more. Integrates with any backend system, giving you full control over your data and no user limits.

Learn more

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay