Published on

Automatically generate .gitignore for your project


When starting a new project from scratch we might often forget to add a .gitignore file. And as a result, we might end up committing dependencies like node_modules (thousands of files) to the repository.

Or in the worst case, we might commit some credentials like API keys and publish it publically.

Ever wondered to create it automatically based on your needs?

That's where comes in.

How to generate a new .gitignore via GUI

  • Just head over to
  • Select the tech stack that you're using. (Select your dev OS also). For example, if you're working on a Next.js project then select "Next.js"
  • Click on Create and it'll generate the file's content.
  • Now, Copy and paste the content into your project's .gitignore file. If it doesn't exist, create one.

How to generate a new .gitignore via CLI

You can generate the file via CLI as well.

Follow their guide and configure it on your machine.

In my case, I prefer to have it as a bash function and use it easily anywhere

# .zshrc or .bashrc
gi() {
  curl -s "$*" > .gitignore

# Make sure to restart the terminal or "source" the zshrc or bashrc file like "source ~/.zshrc"

And to generate the file, run:

gi nextjs,macos

Happy ignoring files!