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.
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 thethumbs.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?"
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
They have nothing to do with git
per se; they're metadata files created by OS X.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With