Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignoring .DS_Store in a gitignore file using Tower

I have a new repo and before I perform the first commit I'd like to ignore .DS_Store files.

I've tried adding the following to the .gitignore file via Tower:

.DS_Store
*.DS_Store
*/.DS_Store

But only the .DS_Store file at the root is ignored, all others are included ready for commit.

Is there a trick to getting these files to be ignored?

like image 732
CMSCSS Avatar asked Apr 29 '13 23:04

CMSCSS


People also ask

Should you add .DS_Store to Gitignore?

DS_Store file in your directories. It's not a big issue, but often you need to exclude these files explicitly in your . gitignore file, to prevent any unnecessary files in your commit. You may want to ignore this file globally, so next time you don't need to add it to your project's ignore list.

How do I ignore a .gitignore file?

gitignore , can be ignored using explicit repository excludes in your_project_directory/. git/info/exclude . This file will not be shared with other developers, and is specific for that single repository.

Why is my file not being ignored in Gitignore?

gitignore ignores only untracked files. Your files are marked as modified - meaning they were committed in the past, and git now tracks them. To ignore them, you first need to delete them, git rm them, commit and then ignore them.


2 Answers

**/.DS_Store

try it out :) Hope it help

like image 89
Alex G Avatar answered Sep 19 '22 04:09

Alex G


Make sure you didn't add to the index those DS_Store first.

If you did, check out "How Can I Remove .DS_Store Files From A Git Repository?", and then check if your .gitignore works.
Use git rm --cached if you want just to remove then from the index while keeping them in the working tree.

Note: only .DS_Store should be enough in your case.

See Objective-C.gitignore from the GitHub Collection of Useful .gitignore Templates.

like image 35
VonC Avatar answered Sep 20 '22 04:09

VonC