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 +```