[英]Remove file from Git without deleting them locally and remotely
I have a repository for a Wordpress intall that currently has all the Wordpress files included. 我有一个Wordpress intall存储库,该存储库当前包含所有Wordpress文件。
I have updated my .gitignore to only include the theme folder but when I push to my staging server it deletes all the files. 我已将.gitignore更新为仅包含主题文件夹,但是当我推送到暂存服务器时,它将删除所有文件。
I need to keep all the files both locally and on the server, but I want them to stop being tracked and removed from the repository, Ideally with the history still intact. 我需要将所有文件都保存在本地和服务器上,但是我希望停止跟踪它们并将其从存储库中删除,理想情况下,历史记录仍保持不变。
Thanks in Advance 提前致谢
The server has a copy of the repository, so if you remove anything from the repository it will be removed from the server's repository as well (after you push). 服务器具有存储库的副本,因此,如果您从存储库中删除任何内容,它也将从服务器的存储库中删除(在您推送之后)。
However, you can set git to assume the files are unchanged . 但是,您可以将git设置为假定文件未更改 。 This will keep them in the repository, but git will stop detecting new changes to them.
这会将它们保留在存储库中,但是git将停止检测对它们的新更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.