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
Add a new --json flag to 'git status' that outputs repository state
in a structured JSON format. This enables reliable machine parsing
of status information for tools and automation.
The JSON output includes:
- Branch information (name, detached state, ahead/behind counts)
- Staged files array
- Unstaged files array
- Untracked files array
- Ignored files array (with --ignored flag)
Implementation details:
- Add STATUS_FORMAT_JSON to wt_status_format enum
- Add JSON output option to git status and git commit
- Implement JSON formatting helpers for arrays and branch info
- Structure output for easy parsing and future extensibility
Example:
$ git status --json
{
"branch": {
"current": "main",
"detached": false
},
"staged": ["file1.txt"],
"unstaged": ["file2.txt"],
"untracked": ["file3.txt"]
}
This provides a robust alternative to parsing traditional output
formats, making it easier to build reliable tools and automation
around Git status information.
Signed-off-by: Tachera Sasi <[email protected]>
Signed-off-by: tacherasasi <[email protected]>
0 commit comments