DEV Community

Cover image for How to create a global .gitignore file
Thomas Rigby
Thomas Rigby

Posted on • Originally published at thomasxbanks.com on

How to create a global .gitignore file

Unfortunately, this has happened to the best of us at some point, amirite?!

Screenshot of GitKraken showing a new git ignore file and 30,383 deleted files in the node modules folder

Inspired by this monstrosity, I decided to do some investigation!

Here is how to create a global .gitignore file to define a list of rules for ignoring files in every single Git repository on your computer…


  touch ~/.gitignore_global
  echo node_modules >> ~/.gitignore_global
  echo .DS_Store >> ~/.gitignore_global
  echo .vscode >> ~/.gitignore_global
  git config --global core.excludesfile ~/.gitignore_global

Enter fullscreen mode Exit fullscreen mode

For more handy git tips: RTFM 😉

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay