Information Technology Reference
In-Depth Information
lists one file
deleted.txt
under
Changes to be committed
. This
means that the operation of removing the file was
staged
.
4. Check the simplified form of status. The output of
$ git status -s
will be:
D_ deleted.txt
This time the staged file removal is denoted by two characters: a letter
D
and a space.
5. Commit the changes with the
$ git commit -m "Staging and
committing removed file"
command.
6. Check the status with the
$ git status -s
command. The output is
empty, therefore the repository is clean. The working directory doesn't
contain the
deleted.txt
file.
How It Works
We start the recipe with a clean repository containing the file
deleted.txt
. The
command
$ git rm deleted.txt
removes the file from the working directory
and stages this operation. Staged and deleted files are denoted by
D_
by the
$ git
status -s
command. After another
$ git commit
command the operation is
committed: the snapshot stored in a revision doesn't contain the file
deleted.txt
.
The flow of Recipe 4-4 is shown in
Figure 4-4
.
Figure 4-4
.
The flow of Recipe 4-4