What is a Git submodule?
BeginnerConceptHooks, submodules, LFS and signing
Answer
A pointer from a parent repo to a specific commit in another repo, recorded as a gitlink entry (mode 160000) plus .gitmodules. The parent pins an exact commit, so builds are reproducible.
git submodule add https://github.com/org/lib.git libs/lib
git clone --recurse-submodules https://github.com/org/app.git
git submodule update --init --recursive
More on Hooks, submodules, LFS and signing
What are Git hooks and where do they live?BeginnerHow do you share hooks with a team, given `.git/hooks` is not committed?IntermediateWhat does the `commit-msg` hook receive and what is it good for?IntermediateWhat do `pre-receive` and `update` hooks do and how do they differ?AdvancedWhy do submodules confuse people and what are the common pitfalls?IntermediateSubmodules versus subtrees versus a monorepo: how do you choose?Advanced