gritHEAD → docs/status
Commands / Getting startedMarkdown

grit status

Show where you are and what's changed. This is what plain grit runs.

grit
grit status
grit st

Description

The status screen is your home base. It shows, from top to bottom:

  • Where you are. The current branch and how it compares with its target branch: how many commits ahead it is, followed by those commits (up to ten). A branch with no commits says no commits yet, and a detached HEAD shows the commit it's on.
  • Staged changes, which are ready to commit.
  • Changed (not staged) files, which have been modified since they were last staged.
  • Untracked files, which grit isn't tracking yet.
  • A hint with the next command to run.

Each change has a label: new, modified, deleted, renamed, copied, type changed or conflict.

Paths are shown relative to the directory you run grit from.

The target branch

The target is the branch your work is headed for. grit uses the first of these that exists:

  1. the branch named in the target.branch config setting
  2. origin/master
  3. origin/main
  4. master
  5. main

To compare against something else, set it for the repository:

$ grit config target.branch origin/develop

Options

grit status takes no options beyond the global ones.

JSON output

Pass --json for stable, scripting-friendly output:

Field Type Meaning
branch string or null Current branch, or null when HEAD is detached.
detached boolean Whether HEAD is detached.
head string or null Full id of the current commit, or null before the first commit.
target string or null Target branch, or null when none was found.
ahead number Commits on the branch that the target does not have.
commits array Newest of those commits, up to ten, each with oid and subject.
staged array Staged changes with path and status.
unstaged array Unstaged changes with path and status.
untracked array Paths of untracked files.
clean boolean true when there is nothing to commit and nothing untracked.
merging boolean true when a merge is in progress (MERGE_HEAD exists).
in_progress array Stable operation ids while work is paused (for example merge, rebase). Omitted when empty.
conflicts array Paths with unmerged index stages. Omitted when empty.

Markdown output