Nikola Brežnjak blog - Tackling software development with a dose of humor
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Home
Daily Thoughts
Ionic
Stack Overflow
Books
About me
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Nikola Brežnjak blog - Tackling software development with a dose of humor
Miscellaneou$

How to remove a .DS_Store file from a Git repo on a Mac

This is a quick tip on how to remove the pesky .DS_Store file from a Git repository on a Mac.

Sure, you can just put it in the .gitignore file, but what if you’d like to remove the .DS_Store files from your folders?

Well, just use this one-liner in the command line: find . -name '.DS_Store' -type f -delete.

You can use this for other files as well. For example, you could use find . -name '*.js' -type f -delete to delete all JavaScript files within a containing folder.

Ok, but what if you accidentally added the .DS_Store file to your Git repository? In that case, add the .DS_Store to your .gitignore file, but also execute the following command:

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

That’s all, hope this helps!

How to remove a .DS_Store file from a Git repo on a Mac https://t.co/lLM5RqqiO0

— Nikola Brežnjak (@HitmanHR) October 27, 2017

Recent posts

  • Discipline is also a talent
  • Play for the fun of it
  • The importance of failing
  • A fresh start
  • Perseverance

Categories

  • Android (3)
  • Books (114)
    • Programming (22)
  • CodeProject (35)
  • Daily Thoughts (77)
  • Go (3)
  • iOS (5)
  • JavaScript (127)
    • Angular (4)
    • Angular 2 (3)
    • Ionic (61)
    • Ionic2 (2)
    • Ionic3 (8)
    • MEAN (3)
    • NodeJS (27)
    • Phaser (1)
    • React (1)
    • Three.js (1)
    • Vue.js (2)
  • Leadership (1)
  • Meetups (8)
  • Miscellaneou$ (77)
    • Breaking News (8)
    • CodeSchool (2)
    • Hacker Games (3)
    • Pluralsight (7)
    • Projects (2)
    • Sublime Text (2)
  • PHP (6)
  • Quick tips (40)
  • Servers (8)
    • Heroku (1)
    • Linux (3)
  • Stack Overflow (81)
  • Unity3D (9)
  • Windows (8)
    • C# (2)
    • WPF (3)
  • Wordpress (2)

"There's no short-term solution for a long-term result." ~ Greg Plitt

"Everything around you that you call life was made up by people that were no smarter than you." ~ S. Jobs

"Hard work beats talent when talent doesn't work hard." ~ Tim Notke

© since 2016 - Nikola Brežnjak