Jakcst
Jakcst

Reputation: 615

What are all these hidden ('._' prefixed) files that are in my git repo?

When I do a 'git status' on my directory, it shows a bunch of untracked files that seem to be duplicates. The only difference is that all have a prefix of ._. For example: One of my untracked files that needs to be added would be... app/assets/stylesheets/categories.css and another file would display as app/assets/stylesheets/._categories.css.

Does anyone know what this is all about? There seems to be no good documentation on GitHub.

Upvotes: 16

Views: 14921

Answers (4)

user3338799
user3338799

Reputation: 11

Mac provides command line command which may be available with command line utilities free downloadable from App store . This cleans up ._ files. Command is $dot_clean

Upvotes: 1

Alan D.
Alan D.

Reputation: 211

If you update your global .gitignore (at C:/Users/user/.gitignore or wherever your user home directory is), you can add this line:

._*

It will prevent these from showing up when you do a git status, and they will not be added via git add -A.

This is what I add to mine to prevent various operating systems inserting garbage into our repos.

# OS generated files #
######################
.DS_Store?
ehthumbs.db
._*
# Icon?
Thumbs.db

Upvotes: 11

VonC
VonC

Reputation: 1328712

As mentioned here:

if for file foo you have another ._foo, and you're on a Mac, the dot-underscore file is where the file resource fork / metadata is kept.

(Described in more details in "DS_Store, dot underscore (._), resource forks and annoyed Windows users")

The .DS_Store is similar to the thumbs.db file Windows XP makes and is used to store “custom attributes of a folder such as the position of icons or the choice of a background image.”

The dot-underscore (._) files are pesky little buggers. It seems that when you use the Finder to transfer files to a non-Mac system–a Windows Server in this case–it splits the file into two parts – the data and the resource forks. When you copy the file back to the Mac, the Finder merges the two bits again. Windows can’t use the resource fork, so it’s not needed and you can delete it, but it’s a lot of hassle having to clean up after others!

See also "Is there any way to prevent a Mac from creating dot underscore files?"

Upvotes: 17

geekosaur
geekosaur

Reputation: 61459

They have nothing to do with git per se; they're metadata files created by OS X.

Upvotes: 2

Related Questions