From: Jakub Narebski <jnareb@gmail.com>
To: Jon Forrest <nobozo@gmail.com>
Cc: git@vger.kernel.org, Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: A Basic Git Question About File Tracking
Date: Sat, 08 Oct 2011 18:17:41 -0700 (PDT) [thread overview]
Message-ID: <m3ipnz0xri.fsf@localhost.localdomain> (raw)
In-Reply-To: <4E90E60C.7060105@gmail.com>
Jon Forrest <nobozo@gmail.com> writes:
> On 10/3/2011 6:22 PM, Jonathan Nieder wrote:
>
> [I'm just getting back to this question. I had accidentally
> sent this follow up directly to Jonathan but I want to
> continue this on the email list.]
>
> > Yes, "x" is tracked. Moreover, "x" is in the index. You can
> > list files in the index with the "git ls-files -s" command.
>
> 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?
>
> I can't prove it but I suspect that many git beginners
> also are confused by this.
You seem to be under [false] impression that git commit is about
_changes_ / _changeset_.
It is not true. What is stored in git commit object is (pointer to)
_snapshot_ of a state of a project at given time. This means that
"git commit" creates a tree object out of state of the index, and
creates commit object that points to said newly created tree, and has
version you started work from as its parent. It is commit remember
the previous version that allows to turn commit into changeset.
Hopefully that would clear up your confusion.
--
Jakub Narębski
next prev parent reply other threads:[~2011-10-09 1:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-04 0:53 A Basic Git Question About File Tracking Jon Forrest
2011-10-04 1:10 ` Jonathan Nieder
2011-10-04 1:14 ` Jon Forrest
2011-10-04 1:22 ` Jonathan Nieder
2011-10-09 0:08 ` Jon Forrest
2011-10-09 1:17 ` Jakub Narebski [this message]
2011-10-09 2:42 ` A Basic Git Question About File Tracking [ANSWERED] Jon Forrest
2011-10-09 9:37 ` Jakub Narebski
2011-10-09 16:57 ` A Basic Git Question About File Tracking Scott Chacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3ipnz0xri.fsf@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=nobozo@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).