{"id":3713,"date":"2017-10-27T07:34:55","date_gmt":"2017-10-27T07:34:55","guid":{"rendered":"http:\/\/www.nikola-breznjak.com\/blog\/?p=3713"},"modified":"2017-10-27T07:46:39","modified_gmt":"2017-10-27T07:46:39","slug":"remove-ds_store-file-git-repo-mac","status":"publish","type":"post","link":"https:\/\/nikola-breznjak.com\/blog\/miscellaneou\/remove-ds_store-file-git-repo-mac\/","title":{"rendered":"How to remove a .DS_Store file from a Git repo on a Mac"},"content":{"rendered":"<p>This is a quick tip on how to remove the pesky <code>.DS_Store<\/code> file from a Git repository on a Mac.<\/p>\n<p>Sure, you can just put it in the <code>.gitignore<\/code> file, but what if you&#8217;d like to remove the <code>.DS_Store<\/code> files from your folders?<\/p>\n<p>Well, just use this one-liner in the command line: <code>find . -name '.DS_Store' -type f -delete<\/code>.<\/p>\n<blockquote><p>\n  You can use this for other files as well. For example, you could use <code>find . -name '*.js' -type f -delete<\/code> to delete all JavaScript files within a containing folder.\n<\/p><\/blockquote>\n<p>Ok, but what if you accidentally added the <code>.DS_Store<\/code> file to your Git repository? In that case, add the <code>.DS_Store<\/code> to your <code>.gitignore<\/code> file, but also execute the following command:<\/p>\n<p><code>find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch<\/code><\/p>\n<p>That&#8217;s all, hope this helps!<\/p>\n<blockquote class=\"twitter-tweet\" data-width=\"550\">\n<p lang=\"en\" dir=\"ltr\">How to remove a .DS_Store file from a Git repo on a Mac <a href=\"https:\/\/t.co\/lLM5RqqiO0\">https:\/\/t.co\/lLM5RqqiO0<\/a><\/p>\n<p>&mdash; Nikola Bre\u017enjak (@HitmanHR) <a href=\"https:\/\/twitter.com\/HitmanHR\/status\/923815480867065856?ref_src=twsrc%5Etfw\">October 27, 2017<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&hellip;<\/p>\n","protected":false},"author":1,"featured_media":3715,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-3713","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-miscellaneou"],"_links":{"self":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/3713","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/comments?post=3713"}],"version-history":[{"count":3,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/3713\/revisions"}],"predecessor-version":[{"id":3718,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/3713\/revisions\/3718"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media\/3715"}],"wp:attachment":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media?parent=3713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/categories?post=3713"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/tags?post=3713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}