Files
git-repo/man
Brian Gan e7cac4bca6 status: Show ahead/behind info for local branches
When viewing `repo status`, it is difficult to distinguish between branches that have active unpushed changes and stale branches that are fully synced. Previously, developers had to run commands like `repo forall -c "git status"` to see their ahead/behind counts.

This change updates Project.PrintWorkTreeStatus to automatically calculate and display the number of commits a branch is ahead and/or behind its upstream tracking branch. We use `git rev-list --left-right --count` to fetch this information natively and efficiently.

If the branch is completely synced with upstream, no extra text is shown.

Added tests for ahead-only, behind-only, diverged, no-tracking, and fully-synced branch states.

Bug: 319412954
Change-Id: I23879b2d472c7a7e11d01b565428a84b1b4f09c1
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/602423
Reviewed-by: Gavin Mak <gavinmak@google.com>
Tested-by: Brian Gan <brgan@google.com>
Commit-Queue: Brian Gan <brgan@google.com>
2026-06-30 11:13:14 -07:00
..
2026-06-25 16:07:53 -07:00
2026-06-25 16:07:53 -07:00
2026-06-25 16:07:53 -07:00
2022-07-11 16:42:23 +00:00
2026-06-25 16:07:53 -07:00
2022-07-11 16:42:23 +00:00
2022-07-11 16:42:23 +00:00
2026-06-25 16:07:53 -07:00
2026-06-25 16:07:53 -07:00
2026-06-25 16:07:53 -07:00
2022-07-11 16:42:23 +00:00
2026-06-25 16:07:53 -07:00
2026-06-25 16:07:53 -07:00
2026-06-25 16:07:53 -07:00
2026-06-25 16:07:53 -07:00
2022-07-11 16:42:23 +00:00
2026-06-25 16:07:53 -07:00
2026-06-25 16:07:53 -07:00
2022-07-11 16:42:23 +00:00
2026-06-25 16:07:53 -07:00
2022-07-11 16:42:23 +00:00
2026-06-25 16:07:53 -07:00
2026-06-25 16:07:53 -07:00
2026-06-25 16:07:53 -07:00
2022-07-11 16:42:23 +00:00
2026-06-25 16:07:53 -07:00
2026-06-25 16:07:53 -07:00