I don’t really know why I didn’t think this was a thing until today but I was having some issues with elixir_ls (a VSCode plugin for Elixir development) plaguing my git repository up and my projects .gitignore file was seemingly ignoring the generated files.
There also seem to be some Github issues talking about the same thing so I wasn’t alone in my folly.
Your git installation can have a global .gitignore file! I’ve been programming for 5 years and had no idea — I’m not really sure why I didn’t consider it in the past.
git config --global core.excludesfile ~/.gitignore
sudo vim ~/.gitignore (or an editor of your choice)
Here are the contents of mine — I took the liberty of adding some other common files I want to ignore in there too:
.DS\_Store node\_modules/ .elixir\_ls/
Some of you might do this then find that your .gitignore hasn’t taken effect — the following commands will fix this:
git add [uncommitted changes you want to keep] && git commit git rm -r --cached . git add . git commit -m "fixed untracked files"
Hope this helped! It cleared up my VScode woes.