Remove .DS_Store files from my git repo and ignore them.

Posted on in Environment Git

I easily can get frustrated from all those auto-generated .DS_Store files on my Mac.
These are the steps to remove and ignore them!

1. Remove all DS store files from the whole folder.
Run the following command in your terminal:

find . -name '*.DS_Store' -type f -delete

2. Create a hidden .gitignore file
My .gitignore file looks like this.
Apart from the .DS_Store store files, I also ignore packages, archives, project settings,
sass-cache files and more:

/.buildpath
/build/
*/archive/

__MACOSX
.DS_Store

.project
.settings
.classpath
.sass-cache/

# OS generated files #
######################
*/.DS_Store
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

3. Commit the removed files and the hidden .gitignore file.

Comments

  1. Stephen Benner says on
    October 1, 2013 at 11:36 am
    Reply

    I add these kind of files to a global ignore as Github suggests here: https://help.github.com/articles/ignoring-files

    But then again, I also include many of them in every repo because you can’t expect people who download your repo’s to follow suite!

  2. Nick Meehee says on
    December 3, 2014 at 6:41 am
    Reply

    Can I just say how much I love you for posting this? I am so sick of deleting those little bastards one by one.

  3. jamie says on
    March 30, 2015 at 6:26 am
    Reply

    OMG thank you for this! We just started using Git with our Sencha projects, you saved me a bunch of trouble 🙂

  4. David says on
    June 5, 2015 at 11:50 pm
    Reply

    Thank you!

Post a Comment

Your email is never published nor shared.
Required fields are marked *