I am on a Mac developing an OS X app with some C/C++ code. I recently added some files to my repository and their duplicate files are showing up as ._name
.
I looked up my .gitignore file and it has .DS_Store
and few other filters but nothing preventing these ._
files.
Is this the right way to add
._*
to my gitignore to prevent these irrelevant files going into repo?
While you could add these files to your . gitignore_global file, it's still important to have the local . gitignore file. If other developers push to the project later, or if you push to it from a different machine, you'll automatically use the local .
gitignore is created, the file will still be part of the repository and therefore cloned. Even that's an overstatement: an entry in a . gitignore file is only considered when some file is untracked. A committed file, as (because) it is being checked out, automatically becomes tracked.
On Mac OS, the finder can in some cases create ._
files that hold some Mac OS specific file information. See https://apple.stackexchange.com/questions/14980/why-are-dot-underscore-files-created-and-how-can-i-avoid-them for details.
However these are OS specific files, and therefore should not be checked into version control anyway.
So a ._*
line in your gitignore will not only ignore your duplicate ._name
files, but the other files it might find that match that pattern need not be checked into version control anyway (apart from any files that you create yourself that match ._*
. In that case you could add an exception in the .gitignore).
Other than that, there is nothing to be found of any other file extensions that start with ._
. See e.g.
So yes, it is safe to ignore ._*
.
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