ace
ace

Reputation: 12024

git status still shows DS_Store file even though it is in the ignore list

In git ignore list I have:

build/**
.DS_Store

After updating some files git status shows:

modified:   db/main/res/.DS_Store

I did not expect to show that .DS_Store is modified because it is in ignore list. Working directory or project root is ~/myproj.

How to fix this problem?

Upvotes: 4

Views: 2205

Answers (1)

tomp
tomp

Reputation: 653

The ".DS_Store" entry in your .gitignore file will prevent new .DS_Store files being tracked by Git when you run git add.

It sounds like the problem in your case is that the .DS_Store file was being tracked by Git before you included .DS_Store in the .gitignore file.

So all you need to do is remove the .DS_Store file from the repo with git rm --cached db/main/res/.DS_Store and it won't be tracked from then on.

(added --cached following Edward's comment).

Upvotes: 8

Related Questions