Where Are Git Submodules Stored?

Where Are Git Submodules Stored?

A submodule can be located anywhere in a parent Git repository's working directory and is configured via a . gitmodules file located at the root of the parent repository. This file contains which paths are submodules and what URL should be used when cloning and fetching for that submodule.

How are git submodules stored?

It is stored in Git's object database directly. The tree object for the directory where the submodule lives will have an entry for the submodule's commit (this is the so-called "gitlink").

Where is the git modules file?

The . gitmodules file, located in the top-level directory of a Git working tree, is a text file with a syntax matching the requirements of git-config[1]. The file contains one subsection per submodule, and the subsection value is the name of the submodule.

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.