You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
status: show default branch comparison when tracking non-default branch
When a branch tracks a non-default remote branch (e.g.,
origin/feature), git status now also displays how the branch
compares to the default branch (origin/main or upstream/main).
This helps users understand if their branch has drifted from the
main development line even when it's in sync with its tracking
branch.
The comparison is shown as a separate line after the tracking
branch status:
- "Ahead of 'origin/main' by N commits" when purely ahead
- "Behind 'origin/main' by N commits" when purely behind
- "Diverged from 'origin/main' by N commits" when diverged
The default branch is determined dynamically by checking:
1. refs/remotes/upstream/HEAD (if upstream remote exists)
2. refs/remotes/origin/HEAD (fallback)
This works with any default branch name (main, master, develop,
etc.) as long as the symbolic ref is configured. The comparison
is also shown when the branch is up-to-date with its tracking
branch but differs from the default branch.
Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
0 commit comments