From 9bcc30a347399255d475c3aa04621ef0d17cca9b Mon Sep 17 00:00:00 2001 From: Jake Lazaroff Date: Tue, 6 Feb 2024 11:47:59 -0500 Subject: [PATCH] Ignore all DS_Store files --- git/ignore-all-ds-store-files.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 git/ignore-all-ds-store-files.md diff --git a/git/ignore-all-ds-store-files.md b/git/ignore-all-ds-store-files.md new file mode 100644 index 0000000..3d72fbc --- /dev/null +++ b/git/ignore-all-ds-store-files.md @@ -0,0 +1,18 @@ +# Ignore all `.DS_Store` files + +If you use git on a Mac, chances are you've accidentally committed a `.DS_Store` to a repo. I used to reflexively add `.DS_Store` to all my `.gitignore` files to avoid ever repeating that mistake. + +But there's a better way! You can add a global `.gitignore` file to your global config with this command: + +```bash +git config --global core.excludesFile '~/.gitignore' +``` + +The single quotes around `~/.gitignore` aren't strictly necessary; if you don't use them, the `~` will just get expanded into the absolute path to your home directory. + +Under the hood, that command just adds this to your `~/.gitconfig`: + +``` +[core] + excludesFile = ~/.gitignore +```