repo
Manage multiple Git repositories
SYNOPSIS
repo
Common
init: Initializes repo in the current directory.
sync: Downloads new changes and updates working files.
forall (or for-all): Runs a shell command on each project.
upload: Uploads changes for code review.
status: Shows the working tree status.
diff: Shows changes between the working tree and the staging area.
start: Starts a new branch for development.
PARAMETERS
The specific repo operation to perform (e.g., init, sync, forall).
-u
Specifies the URL of the manifest repository.
-b
Selects a specific manifest branch.
--depth=
Creates a shallow clone with a specified commit depth.
-j
Runs sync jobs in parallel (number of jobs).
--force-sync (for sync)
Overwrites local changes if a project requires an update.
--current-branch (for sync)
Only syncs the current branch of projects.
-c (for sync)
Alias for --current-branch.
-P
Limits the command to projects matching the specified path (glob pattern).
-c
The shell command to execute for each project.
--no-verify (for upload)
Skips the hook verification step during upload.
--republish (for upload)
Republishes the last change (used for re-uploading).
DESCRIPTION
The repo command is a tool built on top of Git that helps manage multiple Git repositories simultaneously. Primarily used in large-scale software projects like the Android Open Source Project (AOSP), it simplifies the process of cloning, updating, and interacting with many independent Git repositories that form a single cohesive project. Rather than manually cloning and managing dozens or hundreds of individual Git repos, repo uses a 'manifest' file (typically `default.xml` within the .repo/manifests directory) to define the set of repositories, their locations, and their branch configurations. It provides a unified interface to perform operations across all or a subset of these repositories, such as syncing them to a specific state, executing commands in each, or uploading changes for review. repo acts as an orchestrator, automating repetitive Git tasks for complex multi-repository environments.
CAVEATS
The repo command is not a standard Linux system utility and must be installed separately, typically by downloading the script and adding it to your PATH. It is specifically designed for orchestrating large numbers of Git repositories and might be an overkill for simpler projects managed by a single Git repository. Its behavior is heavily dependent on the 'manifest' file, which defines the project structure and repository relationships. Misconfiguration of the manifest can lead to unexpected behavior during synchronization or other operations.
MANIFEST FILES
At the core of repo's functionality are 'manifest files', which are XML files that define the structure of the multi-repository project. These files specify which Git repositories to clone, their remote URLs, their local paths within the working directory, and which branches or revisions to track. repo uses this manifest to orchestrate all its operations, ensuring consistency across all managed repositories.
INSTALLATION
repo is typically installed by downloading a small Python script (named 'repo') from its official repository (e.g., AOSP Git) and placing it in a directory included in the system's PATH environment variable, such as ~/bin/
. It requires a Python interpreter to run.
HISTORY
The repo tool was originally developed by Google to manage the source code for the Android Open Source Project (AOSP), which consists of a vast number of Git repositories. It was created to simplify the process for developers to download, update, and contribute to the Android codebase, addressing the challenges of coordinating changes across numerous interdependent components. Released as an open-source tool, it has since been adopted by other large projects facing similar multi-repository management complexities, providing a robust solution for large-scale distributed development.
SEE ALSO
git(1)