隐藏 git rm --cached 从 GitHub 的已更改文件列表中为 Windows 隐藏文件

Hiding files that have been git rm --cached from the list of changed files in GitHub for Windows

在 Windows 的 GitHub 中,已经 git rm --cached 的文件仍然出现在已更改文件列表中。有什么办法可以隐藏它们吗?

您仍然需要将文件添加到您的 .gitignore 文件中。

http://www.gitguys.com/how-to-remove-a-file-from-git-source-control-but-not-delete-it/:

The git rm command will allows you to remote a file from git control. The –cached option to git remove allows you to leave it on your hard drive.

Every once in awhile a file gets checked into git that isn’t supposed to be there. Common examples are configuration files, project files generated by your IDE with personal settings and even the occasional object file that someone decided to check in. These files are needed, so often you can’t delete them entirely and the process of copying them somewhere else, removing them from git and then replacing is painful, not to mention prone to error.

By adding the –cached option to the git rm command, you are able to remote the file file from git control while keeping the file in your working tree. They command syntax is:

git rm --cached file

Git will no longer track this file even though it is still on your hard drive.

After running the above command, be sure to add an entry to your .gitignore file so that ‘file’ doesn’t show up in ‘git status’ and that it can’t accidentally be re-added later.