2

I summarize the following criterias:

Committed = Stored in .git directory.

Modified = Changed since checked out, but not in the staging area.

Staged = Modified and put into the staging area.

Tracked = ???

Untracked = ???

But I don't know how to decide a file as tracked or untracked. I guess there must be some kind of tracked file collection to search for. Though it seems so natural that a newly created file is considered by Git as untracked.

Thanks.

Alexander
  • 2,052
  • 1
  • 15
  • 17
smwikipedia
  • 61,609
  • 92
  • 309
  • 482

2 Answers2

1

Tracked, by popular usage, is synonymous to committed.

Untracked, is something that has not been committed. So for example a file just added to the working directory is untracked. And again, by popular definition, even something that is added to the index / staged is considered untracked as long as it has not been committed.

manojlds
  • 290,304
  • 63
  • 469
  • 417
0

I'm not sure if there is a formal definition, but if you consider tracked as being in HEAD, than that means that the file was tracked in your previous commit. If you consider a file tracked if it is in the index, than the file is tracked as soon as you add or remove it from the index.

Here is how you see all files currently being tracked in HEAD
git ls-tree HEAD^{tree} -r

If you consider tracked as only needing to be in the index you can view tracked files with
git ls-files

Andy
  • 44,610
  • 13
  • 70
  • 69
  • Many people class a file as "tracked" as soon as it is added to the index whether or not it is in `HEAD`. – CB Bailey Aug 26 '11 at 16:02
  • So, what's HEAD? I have seen this a lot but my textbook hasn't mentioned it *yet*. Could you just give me some *forecast*? ;) – smwikipedia Aug 26 '11 at 16:03
  • @Charles I suppose I could see it either way. If you look at it that way `git ls-files` will show you what is tracked – Andy Aug 26 '11 at 16:08
  • Thanks Andy. As you said "...but if you consider tracked as being in HEAD..." In fact, I don't know what *being tracked* means. And I just want to know how Git decide a file as untracked. – smwikipedia Aug 26 '11 at 16:36
  • I don't think git has a formal definition for "tracked", as you can see by the differing opinions from Charles and manojlds. – Andy Aug 26 '11 at 17:30