【问题标题】:.gitignore Doesn't Seem To Work.gitignore 似乎不起作用
【发布时间】:2023-04-04 15:30:01
【问题描述】:

我的 .gitignore:

.DS_Store
/.idea
/.idea_modules
/out
/project
/target
/*.iml
*/resolution-cache/*
*/streams/*
*/target/*

但尽管如此,.idea.idea_modulestarget 文件夹已出现在存储库中并且仍然存在。

你的想法?

【问题讨论】:

标签: git gitignore


【解决方案1】:

忽略仅对当前未被 repo 跟踪的文件有用。如果这些目录在放入 .gitignore 之前已添加到 repo,它们将继续被跟踪。

使用git rm --cached <file> 停止跟踪文件。

当然,您应该使用已删除的文件进行提交并推送到存储库以查看远程存储库中的更改

【讨论】:

  • 如果我想删除整个文件夹,格式是什么:git rm --cached targetgit rm --cached /target 或其他?
  • 要删除整个文件夹,递归删除git rm --cached -r target
猜你喜欢
  • 2021-09-28
  • 2016-11-29
  • 2016-02-01
  • 2020-09-23
  • 2010-12-05
  • 2011-06-14
  • 2015-01-10
  • 2016-02-24
  • 2011-01-18
相关资源
最近更新 更多