]> Kevux Git Server - rit/commit
status: add status.compareBranches config for multiple branch comparisons
authorHarald Nordgren <haraldnordgren@gmail.com>
Thu, 26 Feb 2026 10:33:42 +0000 (10:33 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 Feb 2026 15:25:48 +0000 (07:25 -0800)
commit3ea95ac9c5a8ac60702b157153498453afe7ab3b
tree354f55d0ac0393cf8e05de661b55ffc1cbbddd9b
parent04f47265c1cfb8dce2287b5fb36ddfaa86a2ac61
status: add status.compareBranches config for multiple branch comparisons

Add a new configuration variable status.compareBranches that allows
users to specify a space-separated list of branch comparisons in
git status output.

Supported values:
- @{upstream} for the current branch's upstream tracking branch
- @{push} for the current branch's push destination

Any other value is ignored and a warning is shown.

When not configured, the default behavior is equivalent to setting
`status.compareBranches = @{upstream}`, preserving backward
compatibility.

The advice messages shown are context-aware:
- "git pull" advice is shown only when comparing against @{upstream}
- "git push" advice is shown only when comparing against @{push}
- Divergence advice is shown for upstream branch comparisons

This is useful for triangular workflows where the upstream tracking
branch differs from the push destination, allowing users to see their
status relative to both branches at once.

Example configuration:
    [status]
        compareBranches = @{upstream} @{push}

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/status.adoc
remote.c
t/t6040-tracking-info.sh