Note: This project was built by AI.
A command-line interface tool for Dart SDK contributors to manage their local branches and track their Gerrit review status.
- List Local Branches: Display all your local Git branches with their Gerrit review status
- Gerrit Integration: Automatically queries Gerrit REST API to get the current status of your changes
- Status Detection: Shows one of five states for each branch:
- WIP (Work in Progress): Changes marked as work-in-progress in Gerrit
- Active: Changes that are ready for review (NEW status in Gerrit)
- Merge conflict: Changes that cannot be merged cleanly
- Merged: Changes that have been successfully merged
- Abandoned: Changes that have been abandoned in Gerrit
- Git repository with Gerrit remotes configured
- Access to
gerrit-review.googlesource.com(for Dart SDK contributions)
dart pub global activate --source path .dart pub global run dgt list
# or simply
dart pub global run dgtHere's what the output looks like when you run dgt in a repository with multiple branches:
Branch Name | Status | Local Hash | Local Date | Gerrit Hash | Gerrit Date
----------------------------------------------------------------------------------------------------------------------------
main | - | a1b2c3d4 | 2025-10-09 10:15 | - | -
feature/new-api | Active | e5f6a7b8 | 2025-10-09 14:30 | e5f6a7b8 | 2025-10-09 14:30
bugfix/memory-leak | WIP | c9d0e1f2 | 2025-10-08 16:45 | c9d0e1f2 | 2025-10-08 16:45
refactor/cleanup | Merged | g3h4i5j6 | 2025-10-07 09:20 | g3h4i5j6 | 2025-10-07 11:00
hotfix/crash | Merge conflict | k7l8m9n0 | 2025-10-09 08:00 | k7l8m9n0 | 2025-10-09 08:00
experiment/perf | - | o1p2q3r4 | 2025-10-06 13:15 | - | -
Total: 6 branches
Color Coding:
- 🟢 Active (Green): Changes ready for review
- 🟡 WIP (Yellow): Work in progress, not ready for review
- 🔴 Merge conflict (Red): Cannot be merged, needs rebase
- 🔵 Merged (Cyan/Blue): Successfully merged
- ⚫ Abandoned (Gray): Abandoned changes
- ⚪ - (White): No Gerrit change (local-only branch)
Difference Highlighting:
When your local branch differs from what's uploaded to Gerrit, the Gerrit hash and/or date will be highlighted in yellow:
Branch Name | Status | Local Hash | Local Date | Gerrit Hash | Gerrit Date
----------------------------------------------------------------------------------------------------------------------------
feature/updates | Active | x1y2z3a4 | 2025-10-09 15:00 | b5c6d7e8 | 2025-10-09 10:00
^^^^^^^^ ^^^^^^^^^^^^^^^^
(highlighted in yellow - different from local)
This indicates that you have local commits that haven't been uploaded to Gerrit yet.
For detailed information about what DGT is doing:
dart pub global run dgt --verbose
# or
dart pub global run dgt -vThis shows:
- Git commands being executed
- Gerrit API queries being made
- Branch processing status
- Query results and timing
Display a summary of execution time breakdown:
dart pub global run dgt --timing
# or
dart pub global run dgt -tThis shows a performance summary after the branch table:
Performance Summary:
Branch discovery: 45ms
Git operations: 320ms
Gerrit API queries: 890ms
Result processing: 28ms
Filtering: 3ms
Total execution time: 1283ms
You can combine with other flags:
dart pub global run dgt -v -t # Verbose output with timing
dart pub global run dgt -p /path/to/repo --timing # Timing for specific repoInclude the Gerrit change URL in the table output:
dart pub global run dgt --urlSave URL column as a default in your config:
# Save the URL column as a default (stored in ~/.dgt/.config)
dart pub global run dgt config --urlAnalyze a repository in a different directory:
dart pub global run dgt --path /path/to/repo
# or
dart pub global run dgt -p D:\projects\dart-sdkSave default display preferences:
# Hide Gerrit columns by default
dart pub global run dgt config --no-gerrit
# Hide local columns by default
dart pub global run dgt config --no-local
# Show all columns (reset to defaults)
dart pub global run dgt config --gerrit --localSave default filter preferences:
# Set default to show only Active branches
dart pub global run dgt config --status active
# Set default to show only diverged branches
dart pub global run dgt config --diverged
# Set default to show branches since a date
dart pub global run dgt config --since 2025-10-01
# Combine multiple defaults
dart pub global run dgt config --status active --status wip --divergedConfiguration is saved to ~/.dgt/.config and applies to all repositories unless overridden by command-line flags.
Filter the branch list to focus on specific branches:
Filter by Status:
# Show only Active branches
dart pub global run dgt --status active
# Show Active and WIP branches
dart pub global run dgt --status active --status wip
# Show only merged branches
dart pub global run dgt --status merged
# Show only branches with merge conflicts
dart pub global run dgt --status conflictAllowed status values:
wip- Work in Progressactive- Ready for reviewmerged- Successfully mergedabandoned- Abandoned changesconflict- Has merge conflicts
Tip: Run
dgt --helpto see all available options and status values.
Filter by Date:
# Show branches with commits after October 1st, 2025
dart pub global run dgt --since 2025-10-01
# Show branches with commits before October 10th, 2025
dart pub global run dgt --before 2025-10-10
# Show branches in a date range
dart pub global run dgt --since 2025-10-01 --before 2025-10-10Filter by Divergence:
# Show only branches that have diverged (local or remote changes)
dart pub global run dgt --diverged
# Combine with status filter
dart pub global run dgt --status active --divergedCombining Filters:
# Active branches that have diverged, updated since October 1st
dart pub global run dgt --status active --diverged --since 2025-10-01
# WIP or Active branches from the last week
dart pub global run dgt --status wip --status active --since 2025-10-03dart pub global run dgt --help- Branch Discovery: Scans your local Git repository for all branches using
git branch --list - Git Information Gathering: For each branch, retrieves commit hash, date, and message (in parallel for performance)
- Config Parsing: Reads
.git/configto extract Gerrit metadata (issue number, server URL, patchset info) - Batch API Queries: Queries Gerrit REST API for all branches at once (batches of up to 10) for optimal performance
- Status Mapping: Translates Gerrit API responses (NEW, MERGED, etc.) into user-friendly status indicators
- Difference Detection: Compares local commit hashes/dates with Gerrit to highlight un-uploaded changes
- Formatted Display: Presents results in a color-coded table with difference highlighting
- Parallel Git Operations: All Git commands run concurrently using Dart's Future.wait
- Batch Gerrit Queries: Multiple changes queried in single API calls (up to 10 per request)
- Isolate-based Processing: Each batch query and JSON parsing runs in a separate isolate
- Result Caching: Git command results are cached to avoid redundant executions
- Partial Success: If some queries fail, continues processing other branches
Typical execution time: < 3 seconds for repositories with dozens of branches.
For more detailed information, see:
- Gerrit API Documentation - Detailed information about Gerrit REST API endpoints, request/response formats, XSSI protection, and batch query optimization
- Git Config Documentation - Explanation of how Gerrit metadata is stored in
.git/configand how DGT uses it - Implementation Plan - Complete implementation roadmap and technical details
- Product Requirements - Original product requirements and design decisions
The tool automatically reads your local Git configuration to extract:
- Gerrit Issue Numbers: From
.git/configbranch settings (e.g.,branch.feature.gerritissue) - Gerrit Server URLs: Server where the change was uploaded (e.g.,
branch.feature.gerritserver) - Change-IDs: Extracted from commit messages as a fallback (format:
Change-Id: I[40 hex chars]) - Patchset Information: Current patchset number and upload hashes
See the Git Config Documentation for full details on the configuration format.
This tool is designed specifically for Dart SDK contributors working with Gerrit code reviews.