【问题标题】:Ignoring .DS_Store in a gitignore file using Tower使用 Tower 忽略 gitignore 文件中的 .DS_Store
【发布时间】:2013-04-23 19:01:23
【问题描述】:

我有一个新的 repo,在执行第一次提交之前,我想忽略 .DS_Store 文件。

我尝试通过 Tower 将以下内容添加到 .gitignore 文件中:

.DS_Store
*.DS_Store
*/.DS_Store

但只有根目录下的 .DS_Store 文件被忽略,所有其他文件都包含在内以供提交。

有什么技巧可以让这些文件被忽略吗?

【问题讨论】:

    标签: gitignore git-tower


    【解决方案1】:

    **/.DS_Store

    试试看 :) 希望对你有帮助

    【讨论】:

      【解决方案2】:

      确保您没有先将那些 DS_Store 添加到索引中。

      如果您这样做了,请查看“How Can I Remove .DS_Store Files From A Git Repository?”,然后检查您的 .gitignore 是否有效。
      如果您只想将 then 从索引中删除,同时将它们保留在工作树中,请使用 git rm --cached

      注意:在您的情况下,只有.DS_Store 就足够了。

      GitHub Collection of Useful .gitignore Templates 看到Objective-C.gitignore

      【讨论】:

      • 谢谢你,我没有将它们添加到 repo 中,因为我还没有完成第一次提交。最后我只是放弃并承诺了它们。
      猜你喜欢
      • 1970-01-01
      • 2014-01-29
      • 2015-11-08
      • 1970-01-01
      • 2022-11-16
      • 2014-07-06
      • 1970-01-01
      • 2011-08-16
      • 2017-06-29
      相关资源
      最近更新 更多