I\'m new to Git. I wish to know what are tracked and untracked files? I read \"Pro Git\", but still couldn\'t quite understand.
Can someone explain to
The Git Pro book chapter you mention tries to detail the notion of untracked file:
When you checkout a given SHA1, you get a "snapshot" of all versioned files.
Any file not referenced by this snapshot is untracked. It isn't part of the Git tree:
See "git - how to tell if a file is git tracked (by shell exit code)?"
Any file that you want to ignore must be untracked (as explained in this GitHub help page).
Note that git will not ignore a file that was already tracked before a rule was added to the
.gitignore
file to ignore it.
In such a case the file must be un-tracked, usually withgit rm --cached filename