I'm currently reviewing Practical Git by Johan Abildskov in preparation for an upcoming job. The first example I came across seems to be impossible.
Here's how it starts:
$ ls
A B C D
$ git status
On branch master
nothing to commit, working tree clean
$ echo testing > A
$ git status
On branch master
nothing to commit, working tree clean
How did he get to this situation? If A is untracked, wouldn't git alert him about the untracked file? If A IS tracked, wouldn't git alert him that the file had changed?
I've been wracking my brain, but I can't figure out how your repository would get to this state.
I can think of a few ways this can happen.
First, you could have the configuration option
status.showUntrackedFilesset tono(either locally for this repo, or globally).Second, you could have a
.gitignoreentry configured to ignoreA.Third, as Timothy Truckle mentioned in the comments,
echo testing > Aoverwrites the contents ofAwith the stringtesting. If that was its content before theechocommand, from git's perspective there'd be no change (i.e., nothing to report about ingit status), since the content of the file is unchanged.