将文件移出版本控制 (Revision Control)

两条重要的 Git 命令:
git rm -r -n --cached /path/to/the/directory

git rm -r --cached /path/to/the/directory


The git rm command removes files from the index, or from the working tree and the index. git rm will not remove a file from just your working directory. (There is no option to remove a file only from just your working tree and yet keep it in the index; use /bin/rm if you want to do that.) The files being removed have to be identical to the tip of the branch, and no updates to their contents can be staged in the index, though that default behavior can be overridden with the -f option. When --cached is given, the staged content has to match either the tip of the branch or the file on disk, allowing the file to be removed from just the index.

-n, --dry-run
Don’t actually remove any file(s). Instead, just show if they exist
in the index and would otherwise be removed by the command.

(excerpted from the man page of git-rm.)

原文地址:https://www.cnblogs.com/Patt/p/6193546.html