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
gritisn'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:
- the branch named in the
target.branchconfig setting origin/masterorigin/mainmastermain
To compare against something else, set it for the repository:
$ grit config target.branch origin/developOptions
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. |