Git 忽略本地删除的文件夹
我有一个 Ruby on Rails 应用程序,当 vendor/rails
存在时它会崩溃,但如果不存在则工作正常。我需要将此文件夹删除在我的本地副本中,以便我可以工作,但我不希望提交此删除操作。有人把它放在那里是有原因的。
那么如何删除这个文件夹而不让它在 git status 中作为一千个已删除文件出现呢?显然 .gitignore
不起作用,因为您无法忽略已跟踪的文件。 此处列出的任何解决方案都没有(git update-index --assume-不变
)工作。
I have a Ruby on Rails application which crashes when vendor/rails
is present but works fine if it is not. I need to keep this folder deleted in my local copy so that I can work, but I don't want this deletion to ever be committed. Someone put it there for a reason.
So how do I delete this folder without it coming up in git status
as a thousand deleted files? Obviously .gitignore
won't work since you can't ignore files which are already tracked. Neither do any of the solutions listed here (git update-index --assume-unchanged
) work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请注意,因为这是基于索引的操作,所以您无法设置要忽略的目录 - 只能忽略单个文件。如果上游在这些目录中添加了文件,您将不得不重复修复。
Note that because this is an index-based operation, you cannot set directories to be ignored – only individual files. If upstream ever adds a file inside those directories, you will have to repeat the fix-up.