尝试在本地删除文件,同时保留存储库中的文件。问题是我似乎无法丢弃已删除的内容。我尝试使用git rm
。但是使用git rm
也会删除存储库中的副本,这不是我想要的。我能想到的唯一解决方案是将路径放入.gitignore
中。是否还有其他解决方案?
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
deleted: stuff/code
.gitignore
中并使用操作系统的常规工具进行删除有什么问题吗?在这种情况下,这似乎正是您应该做的事情。 - Two-Bit Alchemist.gitignore
中是无效的,不会产生任何作用。 - user229044