從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
相關文章
相關標籤/搜索