Information Technology Reference
In-Depth Information
#
#
untracked.txt
The file is listed as both
staged
(
Changes to be committed
) and un-
tracked (
Untracked files
).
4. Check the simplified form of the status. The output of
$ git status -s will be:
D_ untracked.txt
?? untracked.txt
The file is listed twice: as
D_
and
??
.
5. Commit the changes with
$ git commit -m "Committing re-
moved file"
6. Check the status with the
$ git status -s
command.
The output is: ?? untracked.txt
The file is not tracked anymore and is not included in the latest snapshot.
How It Works
This time the single command:
$ git rm --cached [filename]
converts one unmodified file into two different states denoted as
D_ ??
. The first state
indicates that the file was staged. To be more accurate, we can say that the file removal
operation was staged: the next commit will store the snapshot of the working directory
without this file.
The second state, denoted as
??
, specifies that the working directory contains a file
that is not tracked. This file will not be affected by the next commit operation until the
next
$ git add
command is issued.
Recipe 4-6 is illustrated in
Figure 4-6
.