从Git存储库中删除文件而不从本地文件系统中删除它

问题:

My initial commit contained some log files. 个人初始提交包含一些日志文件。 I've added *log to my .gitignore , and now I want to remove the log files from my repository. 我已将*log添加到个人.gitignore ,如今我想从个人存储库中删除日志文件。 git

git rm mylogfile.log

will remove a file from the repository, but will also remove it from the local file system. 将从存储库中删除文件,但也将从本地文件系统中删除它。 this

How can I remove this file from the repo without deleting my local copy of the file? 如何在删除文件本地副本的状况下从存储库中删除此文件? spa


解决方案:

参考一: https://stackoom.com/question/4nYK/从Git存储库中删除文件而不从本地文件系统中删除它
参考二: https://oldbug.net/q/4nYK/Remove-a-file-from-a-Git-repository-without-deleting-it-from-the-local-filesystem
相关文章
相关标签/搜索