git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git working tree status

From
MCMike Clarke <clarkema@gmail.com>
Date
Oct 26, 2008, 21:54 UTC
Message-ID
<73f525b90810261454wb902edfk3a696c06ef2148d1@mail.gmail.com>
Hi all,

I'd like a way of getting a simple summary of the status of a working tree, for consumption by other programs rather than humans.

Specifically, I'd like to know whether the working tree is:

a) fully 'clean' -- i.e., all changes checked in, no stashes; b) all changes checked in, but there are some stashes; or c) 'dirty' in some way -- new files, uncommitted changes, etc.

The logical way to do this seems to be via an exit code, but the exit code of git status is not currently rich enough. As a result, I'm considering the addition of an option to git status -- perhaps '--is-clean' -- that would provide the required information.

My questions are:
1) Is there already some way of doing this that I've overlooked?
2) Would the preferred approach be an option (git status --is-clean)
or a sub-command (git is-clean)?  A sub-command would probably result
in cleaner internal code, but would also clutter the interface.
3) Is a patch for such a feature likely to be accepted?
Thanks,
-- 
Mike Clarke
Next: Miklos Vajna
Message 1 of 4 in “git working tree status”
  1. Mike ClarkeOct 26, 2008
  2. Miklos VajnaOct 26, 2008
  3. Miklos VajnaOct 26, 2008
  4. Mike ClarkeOct 27, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.