Information Technology Reference
In-Depth Information
The two lettered state D_ means that:
• The first character ( D ): the file was removed and the operation was staged.
• The second character (space): the state of the file in the working directory
is exactly the same as in staging area: the file was removed from the work-
ing directory.
How do you reverse the operation performed by the $ git rm [filename]
command? The state after $ git rm is indicated by D_ . First, we unstage the remov-
al with the following command:
$ git reset -- [filename]
This command converts the state from D_ into _D . In the _D state the file is still
missing from the working directory, but the removal is not staged anymore. Thus the
file is available in the staging area. To restore the file from the staging area into the
working directory execute this command:
$ git checkout -- [filename]
The above command restores the file. We can say that it converts _D state into an
unmodified state. The working directory is now clean and the file is restored.
4-5. Committing a file removed with the
standard rm command
Problem
Your repository is in a clean state and contains the removed.txt file. The file is
committed. You want to remove the file using the standard $ rm command and then
commit this modification into the repository.
Solution
Search WWH ::




Custom Search