An Android AOSP tree consists of over 1,000 individual Git repositories orchestrated by Google’s repo tool. When migrating a custom Android board BSP from one release tag (e.g. android-14.0.0_r1) to a newer version (android-14.0.0_r20), manually running git diff inside hundreds of directories is impossible. The repo forall command executes shell commands across every sub-repository in parallel.
Command Syntax: Generating Multi-Repo Tag Diffs
# Run git diff across all repositories between two AOSP tags
repo forall -c 'git diff android-14.0.0_r1..android-14.0.0_r20' > aosp_full_release.patch
# Display modified repository names alongside commit log summaries
repo forall -p -c 'git log --oneline android-14.0.0_r1..android-14.0.0_r20'Key repo forall Flag Breakdown:
`-c <command>`: Executes the enclosed shell command string inside each Git repository working directory.
`-p`: Prints the project header name (e.g.
project framework/base/) before displaying command output.`REPO_PROJECT` Variable: Exposes the manifest project path inside custom shell loops.
Advanced: Filtering Specific Sub-Projects (e.g., Device HALs)
# Restrict diff generation to vendor and hardware HAL repositories only
repo forall hardware/interfaces vendor/my_company -c 'git diff tag_A..tag_B'
Comments and corrections