Skip to content
Cover image for I created a .gitignore command-line generator !

I created a .gitignore command-line generator !

christopherkade profile image Christopher Kade twitter logo github logo ・1 min read  

If you're like me, you pretty much Google "gitignore templates" each time you start a new project from scratch. That's at least 15 seconds you'll never get back, so I made a command-line tool for that 🤷‍♂️

Introducing gitignore-it, here's how it works:


Feel free to install it globally, it's super lightweight and will save you a few seconds.

If you want to contribute, you can always create new .gitignore files that will be usable right away.

And if I've saved you those vital few seconds at the beginning of your project, feel free to give it a little ⭐️ Github Link

twitter logo DISCUSS (22)
markdown guide

I made something similar which I am using locally. I called it Gnit, it git init and also ask for the .gitignore folders to add and also select base on language. It is written in python, I can share with anyone tho.


Create an alias to Git to write:

git ignore -h          # help
git ignore -a "*.tmp"  # add row
git ignore -e          # edit .gitignore
git ignore -l          # list of templates
git ignore             # show .gitignore
git ignore Node        # select template

... etc. I have an alias git exclude too.


Just curious how this differs from the gitignore package that consumes GitHub's awesome gitignore repository.

GitHub logo github / gitignore

A collection of useful .gitignore templates

A collection of .gitignore templates

This is GitHub’s collection of .gitignore file templates We use this list to populate the .gitignore template choosers available in the interface when creating new repositories and files.

For more information about how .gitignore files work, and how to use them the following resources are a great place to start:

Folder structure

We support a collection of templates, organized in this way:

  • the root folder contains templates in common use, to help people get started with popular programming languages and technologies. These define a meaningful set of rules to help get started, and ensure you are not committing unimportant files into your repository
  • Global contains templates for various editors, tools and operating systems that can be used in different situations. It is…

Hey, thanks for sharing this package, I did not know of its existance. I did know of Github's list though as I've used it.

At the moment, the only difference is that I prompt the user for a language. Eventually, I'd like to generate the gitignore automatically based on the user's environment.


That would be great adding the .gitignore during scaffolding automatically based on the environment.


This is nice. Many times in the past I copy-pasted the content of one of the sample gitingore for various programming languages that are maintained on GitHub here

Looks like you've made a nice time saving tool right there! 😄


Man, you have got a solution to my problem

How does it work? i tried installing it on my machine and i run gitignore but i am getting gitignore command not found


Did you install it globally?

npm i -g gitignore-it


Yes, I followed the instructions on npm, I am using windows


I had same problem, command not found and I restarted VS Code and my cmd's.


I actually just published a similar kind of utility for generating "grepignore" files and some other nice things for searching. I was thinking pretty much the same thing you wrote while I was making it.

I can see the gitignore being pretty useful though, I spent way longer than I should have earlier today trying to figure out the right string to get rid of a bunch of junk from a commit.


I am going to definitely check this out for I have been starting a lot more applications using Visual Studio Code and command line and having nice tools to help be just a bit more productive adds up over time to save time.


gitignore zsh plugin allows you to specify multiple gitignore:

gi node ruby >> .gitignore


Can I multiple select? Like as Node, VSCode, MacOs... ?


It could be an option in the future, for now it's one gitignore at a time


Super cool.
I was willing to learn about in near future but I came across this.

Will help a lot.


Great (especially with it having an interactive prompt), but you can add automatic generation which autodetects what tech you use and makes a nice clean .gitignore ;)


Yeah that could be the next step, I could parse the user's package.json (or equivalent file) and generate a gitignore based on that :)


Use it once to generate a global .gitignore in your home directory with everything related to your local env (OS, IDE) and only add specific rules in your repo can avoid .gitignore file full of cruft.

Classic DEV Post from Mar 22

🦠🚪 Show your COVID19 work from home desk? 👩🏻‍💻🪑

What's your COVID19 work from home desk ?

Christopher Kade profile image
Web consultant @ZenikaIT // I sometimes record podcasts, build things and write about the web 👋