]> git.ipfire.org Git - thirdparty/git.git/commit
status: show comparison with push remote tracking branch
authorHarald Nordgren <haraldnordgren@gmail.com>
Tue, 13 Jan 2026 12:11:56 +0000 (12:11 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Jan 2026 14:08:39 +0000 (06:08 -0800)
commitee986235243f166895458c9671fbe3121dc23bca
treedbfa0a22289eb3741c01fd6af8920f66b7c0243d
parentdec85575800028b5e37c363797fdd567e891e192
status: show comparison with push remote tracking branch

"git status" on a branch that follows a remote branch compares
commits on the current branch and the remote-tracking branch it
builds upon, to show "ahead", "behind", or "diverged" status.

When working on a feature branch that tracks a remote feature branch,
but you also want to track progress relative to the push destination
tracking branch (which may differ from the upstream branch), git status
now shows an additional comparison.

When the upstream tracking branch differs from the push destination
tracking branch, git status shows both the comparison with the upstream
tracking branch (as before) and an additional comparison with the push
destination tracking branch. The push branch comparison appears on a
separate line after the upstream branch status, using the same format.

Example output when tracking origin/main but push destination is
origin/feature:
    On branch feature
    Your branch and 'origin/main' have diverged,
    and have 3 and 1 different commits each, respectively.
      (use "git pull" if you want to integrate the remote branch with yours)

    Your branch is ahead of 'origin/feature' by 1 commit.
      (use "git push" to publish your local commits)

The comparison is only shown when the push destination tracking branch
differs from the upstream tracking branch, even if they are on the same
remote.

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