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

[Q] "status" of files in (a part of) the working tree

From
BFBrian Foster <brian.foster@innova-card.com>
Date
Oct 15, 2008, 07:53 UTC
Message-ID
<200810150953.42279.brian.foster@innova-card.com>
Hello,
 For every file in a directory of my working tree,
 I want to obtain a quick "status" summary (ideally,
 recursively, i.e. descending into each sub-directory):
 E.g., not-tracked, latest modification is not in
 the index, latest modification is in the index,
 not-modified, and so on.  As a hypothetical example
 (`# comments' added to explain what the line means):
    $ git some-cmd
    ? foo      # not-tracked
    - bar      # tracked, not-modified
    M xyzzy    # tracked, last modification not-in-index
    I plover   # tracked, last modification in-the-index
     ...
    $ 
 The `git ls-files' command sort-of seems to almost do
 what I want, but not exactly.  For instance (this is
 written by hand but based on actual results):
    $ git version
    git version 1.6.0.2
    $ git ls-files --exclude-standard --others --modified --cached -t
    ? foo
    H bar
    H xyzzy
    C xyzzy
    ...
    $ 
 However, note that some files are listed twice (which
 is confusing for my purposes), and I'm uncertain I've
 specified all the magic to see all non-excluded files
 regardless of their "status".  Obviously, once I know
 the appropriate set of magic I should be able to write
 a filter to process the output and remove the unwanted
 duplicates, but I'm wondering if someone has a better
 suggestion?  Generalissimo Goggle didn't find any clews.
cheers!
	-blf-
-- 
“How many surrealists does it take to   | Brian Foster
 change a lightbulb? Three. One calms   | somewhere in south of France
 the warthog, and two fill the bathtub  |   Stop E$$o (ExxonMobil)!
 with brightly-coloured machine tools.” |      http://www.stopesso.com
Next: Jeff King
Message 1 of 2 in “[Q] "status" of files in (a part of) the working tree”
  1. Brian FosterOct 15, 2008
  2. Jeff KingOct 16, 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.