尽管在.gitignore中,.DS_Store仍然显示为git状态 [英] .DS_Store still appears in git status despite being in .gitignore

查看:1175
本文介绍了尽管在.gitignore中,.DS_Store仍然显示为git状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ cat .gitignore 

# OSX
*/.DS_Store
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

$ git status
On branch develop
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   Assets/Sprites/.DS_Store

no changes added to commit (use "git add" and/or "git commit -a")

现在在.gitignore和status消息中有更多不相关的文件,但.gitignore本身没有被修改,这个版本被提交。

There are more unrelated files in .gitignore and status message right now, but .gitignore itself is not modified, this version is committed.

我该如何解决这个问题?

How can I fix that?

推荐答案

确保 .DS_Store 不在缓存中:

git rm --cached -- Assets/Sprites/.DS_Store

这篇关于尽管在.gitignore中,.DS_Store仍然显示为git状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆