git-subrepo is a Git command that manages external repositories embedded as subdirectories within a parent repository, serving as an alternative to git submodule and git subtree.
The tool solves the problem of integrating and maintaining external code dependencies while keeping them synchronized with upstream sources. It works by cloning an external repository into a subdirectory, then allowing upstream changes to be pulled in and local modifications to be pushed back. The approach distinguishes itself by condensing upstream history into single commits during clone and pull operations, while preserving full commit history for pushes back upstream. It stores metadata in a .gitrepo file that never gets pushed to the upstream repository, and generates well-named branches and remotes to support manual operations when needed.
Adoption suits teams with three distinct user roles: repository owners who want to avoid submodule synchronization complexity, regular users who simply clone the parent repository and automatically receive all subrepos without needing to install the tool, and collaborators who only need to install git-subrepo if they intend to push or pull changes. The tool handles operations that typically cause problems with alternatives, including branching, moving or renaming subrepo directories, and rebasing. It requires no configuration and keeps git history clean by avoiding the extraneous commits that other tools introduce. Subrepos can themselves contain nested subrepos, and different branches can maintain different subrepo states independently.
The project maintains active development with regular commits addressing bug fixes and feature improvements. The codebase shows consistent attention to edge cases and user experience refinements. Documentation is comprehensive and regularly updated to reflect current functionality. The tool continues to receive maintenance that ensures compatibility with modern Git versions and addresses issues reported by users.