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

Re: A Basic Git Question About File Tracking

From
Scott Chacon <schacon@gmail.com>
Date
Oct 9, 2011, 16:57 UTC
Message-ID
<CAP2yMaLKxtN-i6XikBTd9XeJ9_5HnAMxj=VnPMU=WsMNb6MsYw@mail.gmail.com>
In-Reply-To
<m3ipnz0xri.fsf@localhost.localdomain>
Jon,
2011/10/8 Jakub Narebski <jnareb@gmail.com>:
Show 12 quoted lines
>> This spoils my understanding of what the index
>> is. I had been thinking that after you add files
>> to the index, and then commit, the index is then
>> empty. In other words, whatever's in the index
>> gets committed, and then the index is cleaned.
>>
>> On the other hand, if the definition of a tracked
>> file is a file that's in the index, then this definitely
>> clears up my understanding of tracked files.
>>
>> If every file that's 'git add'ed stays in the
>> index, how does git know which files to commit?

It may help to read a blog post I put on the Pro Git blog called "Reset Demystified" that talks about a simplified model of the HEAD, index and working directory.

http://progit.org/2011/07/11/reset.html

Let me know if that helps. And you're right, the book should say "not in the index" rather than "not be in the last commit", that would be more technically correct. I think at that point in the book I have not gone into any details about the index yet, so it would be confusing without more detail.

thanks, Scott

Previous: Jakub Narebski
Message 9 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.