Repo usage takes the following form:

repo <COMMAND> <OPTIONS>

Optional elements are shown in brackets [ ]. For example, many commands take a project list as an argument. You can specify project-list as a list of names or a list of paths to local source directories for the projects:

repo sync [<PROJECT0> <PROJECT1> ... <PROJECTN>]
repo sync [</PATH/TO/PROJECT0> ... </PATH/TO/PROJECTN>]

help

Once Repo is installed, you can find the latest documentation starting with a summary of all commands by running:

repo help

You can get information about any command by running this within a Repo tree:

repo help <COMMAND>

For example, the following command yields a description and list of options for the init argument of Repo, which initializes Repo in the current directory. (See init for more details.)

repo help init

init

repo init -u <URL> [<OPTIONS>]

Installs Repo in the current directory. This creates a .repo/ directory that contains Git repositories for the Repo source code and the standard Android manifest files. The .repo/ directory also contains manifest.xml, which is a symlink to the selected manifest in the .repo/manifests/ directory. See manifest-format.md for instructions on updating the manifest.

Options:

Note: For all remaining Repo commands, the current working directory must either be the parent directory of .repo/ or a subdirectory of the parent directory.

sync

repo sync [<PROJECT_LIST>]

Downloads new changes and updates the working files in your local environment. If you run repo sync without any arguments, it will synchronize the files for all the projects.

When you run repo sync, this is what happens:

After a successful repo sync, the code in specified projects will be up to date with the code in the remote repository.

Options:

upload

repo upload [<PROJECT_LIST>]

For the specified projects, Repo compares the local branches to the remote branches updated during the last repo sync. Repo will prompt you to select one or more of the branches that have not yet been uploaded for review.

After you select one or more branches, all commits on the selected branches are transmitted to Gerrit over an HTTPS connection. You will need to configure an HTTPS password to enable upload authorization. Visit the Password Generator to generate a new username/password pair to use over HTTPS.

When Gerrit receives the object data over its server, it will turn each commit into a change so that reviewers can comment on each commit individually. To combine several "checkpoint" commits together into a single commit, use git rebase -i before you run repo upload.

If you run repo upload without any arguments, it will search all the projects for changes to upload.

To make edits to changes after they have been uploaded, you should use a tool like git rebase -i or git commit --amend to update your local commits. After your edits are complete:

After the upload is complete the changes will have an additional Patch Set.

If you only want to upload the currently checked out Git branch, you can use the flag --current-branch (or --cbr for short).

diff

repo diff [<PROJECT_LIST>]

Shows outstanding changes between commit and working tree using git diff.

download

repo download <TARGET> <CHANGE>

Downloads the specified change from the review system and makes it available in your project's local working directory.

For example, to download change 23823 into your platform/build directory:

repo download platform/build 23823

A repo sync should effectively remove any commits retrieved via repo download. Or, you can check out the remote branch; e.g., git checkout m/master.

Note: There is a slight mirroring lag between when a change is visible on the web in Gerrit and when repo download will be able to find it for all users, because of replication delays to all servers worldwide.

forall

repo forall [<PROJECT_LIST>] -c <COMMAND>

Executes the given shell command in each project. The following additional environment variables are made available by repo forall:

Options:

prune

repo prune [<PROJECT_LIST>]

Prunes (deletes) topics that are already merged.

start

repo start <BRANCH_NAME> [<PROJECT_LIST>]

Begins a new branch for development, starting from the revision specified in the manifest.

The <BRANCH_NAME> argument should provide a short description of the change you are trying to make to the projects.If you don't know, consider using the name default.

The <PROJECT_LIST> specifies which projects will participate in this topic branch.

Note: "." is a useful shorthand for the project in the current working directory.

status

repo status [<PROJECT_LIST>]

Compares the working tree to the staging area (index) and the most recent commit on this branch (HEAD) in each project specified. Displays a summary line for each file where there is a difference between these three states.

To see the status for only the current branch, run repo status. The status information will be listed by project. For each file in the project, a two-letter code is used:

In the first column, an uppercase letter indicates how the staging area differs from the last committed state.

letter meaning description
- no change same in HEAD and index
A added not in HEAD, in index
M modified in HEAD, modified in index
D deleted in HEAD, not in index
R renamed not in HEAD, path changed in index
C copied not in HEAD, copied from another in index
T mode changed same content in HEAD and index, mode changed
U unmerged conflict between HEAD and index; resolution required

In the second column, a lowercase letter indicates how the working directory differs from the index.

letter meaning description
- new/unknown not in index, in work tree
m modified in index, in work tree, modified
d deleted in index, not in work tree