When developing on the Mac, using Git as your version control system, one of the first things you’ll notice is that Git adds
.DS_Store
files to your repository.
This is not needed, as .DS_Store basically just handles settings on the directory it’s in, and as such it’s useless to share this with other developers. You can ignore the files per repository, but the best approach is usually to ignore it on a global level. Here is how to do it.
How to ignore files globally in Git
First, you’ll need a global exclude file. This is created by entering the Terminal, and enter the following:
git config --global core.excludesfile ~/.gitignore
This sets up a global ignore file, ready to ignore file matches. It works by adding matches on a seperate line, causing Git to ignore these, when listing / committing changes. The file may be edited using your favorite editor, or you may simply add
.DS_Store
to it by entering the following in Terminal:echo .DS_Store >> ~/.gitignore
And that’s basically it. Just remember, that
.DS_Store
files already in repositories, will not be removed automatically from the repository.
Ingen kommentarer:
Send en kommentar