TIL global .gitignore

My first day at Planning Center was Monday, September 18th, 2023, and I was not looking forward to re-configuring my development environment. I currently use RubyMine, which generates quite a few files when opening a project for the first time (a mark of shame for a RubyMine user amongst vim users 🤣). Naturally, I created a PR to add the auto-generated .idea directory to the .gitignore file to prevent these files from being committed to version control. Later, I learned that you can have a global .gitignore file on your machine that will prevent the need to update every .gitignore file of every new project that you open 🙌🏼. I stole the following steps from this gist:

  1. Create a .gitignore file in your home directory
$ cd
$ touch .gitignore
  1. Configure git to recognize it as a global .gitignore file
$ git config --global core.excludesFile ~/.gitignore
  1. Update the .gitignore file to include any file paths you want to exclude
# Ignore files auto-generated by JetBrains
  1. Confirm that the configuration is correct
$ git config --global core.excludesFile

And that’s it! Cheers to no longer needing to update every .gitignore file of every project 🍻

Tagged til git