Eclipse Git 插件 - 从存储库中删除文件而不删除本地
使用 Egit 插件,是否可以从源代码管理中永久删除文件而不删除本地副本?
即,是否有相当于运行“git rm --cached”的 GUI 操作?
(编辑以简化问题)
Using the Egit plugin, is it possible to permanently remove a file from source control without deleting the local copy?
I.e., is there a GUI action equivalent to running "git rm --cached"?
(Edited to simplify question)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我已经找到答案了。 Team->Untrack 确实相当于“rm --cached”。然而,有一个已知的错误,当您取消跟踪然后尝试提交时,它会产生奇怪的行为。
https://bugs.eclipse.org/bugs/show_bug.cgi?id=363405
I have found the answer. Team->Untrack is indeed the equivalent of "rm --cached". However there is a known bug which produces weird behaviour when you untrack and then try to commit.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=363405
为我完成了这项工作(
git rm --cached
)。did the job (
git rm --cached
) for me.在最初没有将目录和文件包含在 .ignore 中之后,我遇到了同样的问题。我还尝试了“取消跟踪”和“从索引中删除”的可能性,但没有任何帮助(由于仍未解决的 Egit 问题)。
所以,最后我在本地删除了文件(让项目全部陷入错误),提交并推送到github,然后在本地撤消删除并将文件添加到.ignore。
非常不优雅,但它有效。
我为此浪费了很多时间和精力,希望这对某人有所帮助。
I had the same problem, after not initially including directories and files in .ignore. I also tried "Untrack" and "Remove from index" possibility, non of which helped(due to the still unresolved Egit issue).
So, in the end I deleted files locally (leaving the project all in bugs), committed and pushed it to the github, and then undid the delete locally and added files to .ignore.
Very unelegant, but it worked.
I lost a lot of time and nerves on it, and I hope this helps someone.
另一种选择与 Sri Sankaran 在评论中建议的类似,是更新索引以假设没有修改到您的配置文件:
在 Egit 的首选项中,您可以列出“假定未更改”的文件
:
文件保留版本并位于磁盘上,但不会检测到任何修改。
Another option, similar to what Sri Sankaran suggests in the comments, is to update the index in order to assume no modification to your config file:
On the preferences, in Egit, you can list "assumed unchanged" files
:
The file remains versioned and on the disk, but no modification will be detected on it.
如果您需要从 eclipse 项目中删除不可见的文件夹(或文件):
If you need to delete invisible folder(or file) from eclipse project: