Comment by deaddodo
3 years ago
> Those .DS_Store files are created in arbitrary directories by the Apple file manager or something.
.DS_Store files come from Apple's file systems containing a separate data and resource fork. APFS can natively store the contents, but for foreign file systems/network shares, a .DS_Store file is created to store those attributes.
I don't have OCD but the casing of .DS_Store annoys me a lot for some reason. I have turned on option to display dot files in finder and I see this god awful name everywhere. It could be .DSStore, .ds_store, .DS Store or even .DS_STORE, current one is the worst.
> .DS_Store files come from Apple's file systems containing a separate data and resource fork
No, that would be ._<filename> files (containing resource forks, when the corresponding file is stored on a volume with a FS not supporting them natively), which are much rarer these days given that resource forks are not really used anymore.
.DS_Store contains Finder metadata, as far as I know (non-default icon sorting or positioning, categories, tags etc.), and they occur on all volumes, including Mac native filesystems. Finder just hides them by default.
I never knew that. How come they end up in Git repositories then? They shouldn't be visible to Git running on a native Mac filesystem?
They're just a file, so git can see it. Good habit would be to add it to the project's gitignore, or your global gitignore (or both)
It's a pet peeve of mine when people put stuff like this in a project's `.gitignore`. The proper place is either your global gitignore (probably appropriate for stupid stuff like this) or in your clone in `.git/info/exclude`.
`.gitignore` is for stuff that all developers need to ignore, like compiler output, and should be kept to the bare minimum.
8 replies →
So they are not a resource fork, then.
They are visible to programs, for example if you run `ls -a` you will see them on macOS too. I reckon they're only transparent to Finder (where you can't see them even if you're showing hidden files).