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

A Basic Git Question About File Tracking

From
Jon Forrest <nobozo@gmail.com>
Date
Oct 4, 2011, 00:53 UTC
Message-ID
<j6dlhf$dp3$1@dough.gmane.org>

I've been reading the Pro Git book. I'm having trouble really understanding the concept of file tracking. Here's where my confusion starts.

The Pro Git book says "Untracked basically means that Git sees a file you didn’t have in the previous snapshot (commit)".

Is this right? I can easily think of a counter example. Let's say you put a new file in the working directory of a Git repo. Then you "git add" it. At this point, the file hasn't been in any commit. Yet, 'git status' doesn't show the file as being untracked. Should that statement be "Untracked basically means that Git sees a file you didn’t have in the previous snapshot (commit) or a file that hasn't been staged."?

One additional confusing thing is that "git add" apparently both starts tracking a file and puts it in the index the first time a file is added. Thereafter, "git add" only puts the file in the index. One of my research projects is to understand what goes on internally when a file is tracked.

Jon Forrest
Next: Jonathan Nieder
Message 1 of 9 in “A Basic Git Question About File Tracking”
  1. Jon ForrestOct 4, 2011
  2. Jonathan NiederOct 4, 2011
  3. Jon ForrestOct 4, 2011
  4. Jonathan NiederOct 4, 2011
  5. Jon ForrestOct 9, 2011
  6. Jakub NarebskiOct 9, 2011
  7. Jon ForrestOct 9, 2011
  8. Jakub NarebskiOct 9, 2011
  9. Scott ChaconOct 9, 2011

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.