【问题标题】:.gitignore ignoring files which are excluded from the ignore list [duplicate].gitignore 忽略从忽略列表中排除的文件[重复]
【发布时间】:2021-08-15 04:02:52
【问题描述】:

我正在使用带有内置 git 功能的 Eclipse 做一个 Java 项目。我在与.gitignore 文件相同的目录中有一个Images 文件夹。 我想忽略Images 中的所有文件,除了Destroyed-icon.png Layer_dot.png Not-enough-repair-packs-icon.png
根据Is there a way to tell git to only include certain files instead of ignoring certain files?,我应该可以在我的.gitignore 文件中使用以下内容,但它不起作用。整个Images 目录被忽略。

Images
!Images/Destroyed-icon.png
!Images/Layer_dot.png
!Images/Not-enough-repair-packs-icon.png

我已经尝试在Images 之前和之后添加/删除所有/,重新启动eclipse,关闭并重新打开项目,但这些都不起作用。
也没有什么要拉的,我的本地存储库是最新的。

【问题讨论】:

标签: git eclipse gitignore


【解决方案1】:

处理此问题的最简单方法是忽略Images,而只忽略git add -f 您要跟踪的文件。添加它们后,无论.gitignore 对它们说什么,git 都会密切关注它们。

【讨论】:

  • 并没有真正回答我的问题,但工作正常,谢谢
猜你喜欢
  • 2020-02-17
  • 2014-09-13
  • 2022-11-16
  • 1970-01-01
  • 2014-07-06
  • 1970-01-01
  • 2011-10-27
  • 2019-04-29
  • 2018-05-02
相关资源
最近更新 更多