Repo complements Git by simplifying work across multiple repositories. See Source Control Tools for an explanation of the relationship between Repo and Git. For more details on Repo, see the Repo README. Show Repo use takes the following form: repo command optionsOptional elements are shown in brackets [ ]. For example, many commands take 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]helpThis page merely highlights key options. See the command line help for full details. When Repo is installed, you can find the latest documentation starting with a summary of all commands by running: repo helpYou can see detailed information about any command by running this within a Repo tree: repo help commandFor 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 details.) repo help initOr to see only the list of available options, run: repo command --help For example: repo init --helpinitrepo init -u url [options]Installs Repo in the current directory. This creates a .repo/ directory with Git repositories for the Repo source code and the standard Android manifest files. 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. syncrepo sync [project-list]Downloads new changes and updates the working files in your local environment, essentially accomplishing git fetch across all Git repositories. If you run repo sync without arguments, it synchronizes the files for all projects. When you run repo sync, this is what happens:
After a successful run of repo sync, the code in specified projects is up to date and synced with the code in the remote repository. Here are key options. See repo help sync for more:
uploadrepo upload [project-list]For the specified projects, Repo compares the local branches to the remote branches updated during the last Repo sync. Repo prompts you to select one or more of the branches that haven't been uploaded for review. All commits on the selected branches are then transmitted to Gerrit over an HTTPS connection. You 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 turns each commit into a change so that reviewers can comment on a specific commit. To combine several checkpoint commits into a single commit, use git rebase -i before you run the upload. If you run repo upload without arguments, it searches all of the projects for changes to upload. To edit changes after they've been uploaded, 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 have an additional patch set. If you want to upload only the currently checked out Git branch, use the flag --current-branch (or --cbr for short). diffrepo diff [project-list]Shows outstanding changes between the commit and the working tree using git diff. downloadrepo download target changeDownloads 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 23823Running repo sync removes any commits retrieved with repo download. Or you can check out the remote branch using git checkout m/master. Note: There are replication delays to all servers worldwide, so there's a slight mirroring lag between when a change is visible on the web in Gerrit and when repo download can find the change for all users. forallrepo forall [project-list] -c commandExecutes the given shell command in each project. The following additional environment variables are made available by repo forall:
Options:
prunerepo prune [project-list]Prunes (deletes) topics that are already merged. startrepo start branch-name [project-list]Begins a new branch for development, starting from the revision specified in the manifest. The BRANCH_NAME argument provides a short description of the change you're trying to make to the projects. If you don't know, consider using the name default. The project-list argument specifies which projects participate in this topic branch. Note: A period ( . ) is shorthand for the project in the current working directory. statusrepo 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 of just the current branch, run repo status .. The status information is 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.
In the second column, a lowercase letter indicates how the working directory differs from the index.
Handling repo errorsgit commit -a # Commit local changes first so they aren't lost. repo start branch-name # Start the branch git reset --hard HEAD@{1} # And reset the branch so that it matches the commit before repo start repo upload .The error repo: error: no branches ready for upload appears when the command repo start wasn't run at the start of the session. To recover, you can check the commit id, start a new branch and then merge it. |