Stop tracking a file in git - without having it deleted either locally or on pull

我的未来我决定 提交于 2019-12-02 01:03:37

This is not possible. To prevent new changes from being tracked, you need to remove the file from the repository (using git rm or git rm --cached). This adds a change to the commit that removes the file. When that change is then applied in other repositories, the remove action is performed, resulting in the file being removed.

I had kind of the same problem, I used git rm --cached <file> and it worked locally but once I made a push to the remote server it deleted also the files, and I did not want that.Then I found git update-index --assume-unchanged <file> and it ignores the local changes and does not delete it from the remote server, worked like a charm!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!