Repo Command Reference
Certainly! Let's break down the command you shared:
repo forall -c 'git status --short' | grep -v "^$"This command is used in a repo-managed Android source code environment to show a concise list of modified files across all git repositories, excluding empty lines. Here’s a detailed explanation:
🔧 Full Breakdown
1. repo forall -c 'git status --short'
🛠 What is repo forall?
repo forall is a command provided by the Repo tool used to manage multiple Git repositories (as Android source code is split across many repos).
It executes a given shell command in each Git repository managed by
repo.
📘 Syntax:
repo forall [project-list] -c [command]🧠 In this case:
-c 'git status --short'Means: for each project (repository) in the repo workspace, run:
git status --short2. git status --short
This is a concise version of git status, which shows the status of working directory changes in a short, machine-readable format.
✅ Output format:
Each line corresponds to one file and shows its status using two-character flags:
??
Untracked file
M
Modified in the working directory
M
Modified in the index (staged)
A
Added to index
D
Deleted from index
D
Deleted from working directory
For example:
3. | grep -v "^$"
This part filters out empty lines from the output.
grep -vmeans: exclude lines that match the given pattern."^$"is a regular expression that matches an empty line:^= start of line$= end of lineSo
^$= line with nothing on it.
✅ Final Outcome
This command gives you:
A summary of all file-level changes (new, modified, deleted, etc.) in each repo.
Filters out empty lines to only show meaningful status information.
📌 Example Output
Let’s say you have 3 Git repos in your Android source tree.
Here’s an example output:
This tells you which files have changes across the entire workspace, making it easier to review your own changes before committing.
✅ Use Case
You asked:
“
repo statusis showing too many files, I wish to see only changes that I have made”
This command is perfect for your need, because:
repo statusalso shows remote tracking and branch information.repo forall -c 'git status --short'shows only local working directory changes.The
grep -v "^$"keeps the output clean.
🚀 Bonus Tip: Show repo path with filename
If you also want to see the repo/project name before each line, use:
This will prefix each set of changes with the relative path of that repo.
Let me know if you want a more advanced version (e.g., show only staged files, or only modified files).
Last updated