5

I am new to Git, and every time I work with it, I always get this annoying .DS_Store in my untracked files. I am assuming that is where my working directory is.

I have tried searching the answer on Stack Overflow, but only found the answer on how to remove it from the repository, not from the list of untracked files.

How can I tell Git to completely ignore .DS_Store files and never list them as untracked files?

Mureinik
  • 277,661
  • 50
  • 283
  • 320
Eldan Shkolnikov
  • 421
  • 1
  • 5
  • 13

1 Answers1

14

You could create a .gitignore file. This file tells git which file (changes) it should ignore, so they won't appear in git status, git diff etc. call.

.gitignore is a simple text file. Just create it in a text editor (or edit it if you already have one), and add this line:

.DS_Store

Then, you should add it to the repository, so these files are ignored by all collaborators:

git add .gitignore
git commit -m "added .gitignore"
Mureinik
  • 277,661
  • 50
  • 283
  • 320