Skip to main content
gx context (alias gx ctx) shows a compact summary of your current repo state: branch, tracking status, last commit, working tree, stash count, and any active operations.

Usage

gx context
gx ctx

What It Shows

SectionDetails
BranchCurrent branch name, or detached HEAD indicator
TrackingRemote tracking branch with ahead/behind counts
vs mainAhead/behind relative to the HEAD branch (main/master)
Last commitShort hash, message, and age
Working treeModified, staged, and untracked file counts, or “clean”
StashNumber of stash entries, or “empty”
Active opsWarnings for merge, rebase, or cherry-pick in progress

Example Output

Branch:      feature/auth
Tracking:    origin/feature/auth (2 ahead, 1 behind)
vs main:     5 ahead, 12 behind

Last commit: a1b2c3d "add OAuth provider" (5 minutes ago)

Working tree:
  Modified:  2 files
  Staged:    1 file
  Untracked: 3 files

Stash:  2 entries
When in detached HEAD state, gx shows the short hash instead of a branch name and prints WARN You are in detached HEAD state.

Active Operation Warnings

If a merge, rebase, or cherry-pick is in progress, gx shows a warning at the bottom:
WARN Merge in progress
WARN Rebase in progress
WARN Cherry-pick in progress
gx context is a read-only command. It never modifies your repo. Run it as often as you want to get your bearings.
  • Tracking status is shown only if the branch has an upstream configured
  • The “vs main” line is hidden when you are already on the HEAD branch
  • Stash count shows “empty” when there are no stash entries
  • Working tree shows “clean” (in green) when there are no modifications