Product SiteDocumentation Site

3.3.5. Unmodified files

The unmodified status is where those files that have not changed are kept. Git is aware of them and is tracking them so that when an edit is made they are transferred to the modified status. Also, after a commit, the files are returned to this state.
It is also possible to remove files from this state to stop Git from tracking them. This will remove them locally as well. To do so run:
$ git rm filename
rm 'filename'
$ git status
# On branch master
#
# Changes to be committed:
#	(use "git reset HEAD <file>..." to unstage)
#
#		deleted:	filename
#

Removing a file

Note, that if a file is unmodified, git rm filename will remove the entire file. It is only when a file has uncommitted changes that git rm filename will give a diagnostic and not remove it. To remove a file despite the uncommitted changes, use the --force or -f option.
To stop Git from tracking a file without removing it locally, use the --cached option, then commit the removal.
$ git rm --cached filename
$ git commit -m'remove file message'