DEV Community

Cover image for gitignore.io is great!
Mike Bifulco
Mike Bifulco

Posted on • Originally published at mikebifulco.com

gitignore.io is great!

Put simply, gitignore.io is a that is so profoundly helpful that I've forgotten what life was like without it.

Its purpose is simple: for any project you're working on, it'll generate a valid .gitignore file for you. All you need to do is use the autocomplete box provided to describe the type of project you're working on:

select anything relevant for you using the autocomplete box

Note: A .gitignore file is used to tell git to exclude files from being added to a given repo. Each line of the file represents a filename, directory, or pattern. When git looks for changes in your working directory, it will automatically ignore any file that matches an entry in your .gitignore file.

From there, you'll hit the Create button, which will bring you to a page that displays nothing but the raw text which you'll need to add to your project's .gitignore. If you selected just react, for example, this is what you'd see on the next page:

# Created by https://www.toptal.com/developers/gitignore/api/react
# Edit at https://www.toptal.com/developers/gitignore?templates=react

### react ###
.DS_*
*.log
logs
**/*.backup.*
**/*.back.*

node_modules
bower_components

*.sublime*

psd
thumb
sketch

# End of https://www.toptal.com/developers/gitignore/api/react
Enter fullscreen mode Exit fullscreen mode

That's all there is to it, too! I use it on the vast majority of projects I work on, new and old, and as far as I can tell, it hasn't let me down in any meaningful way.

It's Open Source!

One of the reasons I like this tool so much is that it gets better the more people use it. Is it missing support for a project type that you work with? Go ahead and submit a Pull Request, and it may be integrated into the product one day. Or, if you're not quite comfortable with a full-on PR, you can start the discussion in an issue on the repo. Maybe something isn't working like you'd expect -- and it's worth pitching in your two cents in the discussion on an open issue. All of that is contributing to Open Source -- don't forget!

As I understand it, it was created by @joeblau, and quickly gained momentum with developers. As I write this post, there are 135 contributors on the project.

Gitignore.io is a great example of a successful Open Source tool born out of the desire for an improved developer workflow. It currently appears to be operated by TopTal, a company that helps freelancers find work.

(note for transparency: I have no connection to TopTal, and this is not a sponsored post. I do work for Aquent, which is a creative staffing agency. If you're looking for work, give us a shout!)

There's a CLI

If you prefer it, there's a CLI which will help you generate gitignore files, powered by this same project. I can't say I've used it, but I know some of you will want to give it a go, so it's worth mentioning

There's other options, too

If you don't find gitignore.io particularly appealing, there's always other ways to cretae your .gitignore file. You can write it by hand, or grab one from another project you work on. GitHub also maintains a repo of popular gitignore files, which seems to be updated quite frequently as well.

Was this helpful?

If you found this useful, I'd love it if you subscribed to my mailing list. It's free!

Top comments (17)

Collapse
 
waylonwalker profile image
Waylon Walker • Edited

I had no idea there was a cli, I always just use CURL. I generally use pretty similar .gitignore's depending on the type of project that I am working on.

I keep this one as a shell alias

alias ignore='curl https://www.gitignore.io/api/vim,node,data,emacs,python,pycharm,executable,sublimetext,visualstudio,visualstudiocode > .gitignore'
Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

It's just a shell script, but working at function level.

I do this quite often.

gi macos,node > .gitignore 

You can't misspell, though. For example, it must be node not node.js or nodejs.

Collapse
 
titanhero profile image
Lex

You miss the ' ' in the alias, anyway cool.

Collapse
 
waylonwalker profile image
Waylon Walker

Thanks for the catch, fixed it

Collapse
 
vlasales profile image
Vlastimil Pospichal

I don't want to distribute a list of my private files and directories in project to other developers. I save my settings to .git/info/exclude

Collapse
 
irreverentmike profile image
Mike Bifulco

Sure - I get that. There's a purpose for that ~/.git directory in addition to .gitignore on individual projects. The latter is useful if you ever work with anyone else, which is where this config and tool come in...

Collapse
 
vlasales profile image
Vlastimil Pospichal

Each developer on a project can have a different IDE and it is unnecessary to accumulate it in one .gitignore. The third solution is the global .gitignore.

I usually use my own Makefile to handle the project on local machine.

Thread Thread
 
irreverentmike profile image
Mike Bifulco

Different strokes, I suppose. There are absolutely some files that are regularly .gitignoreed that are independent of IDE.

node_modules/ forel example, and often there are .env.something files with varying names depending on the project type.

I'm sure you've experienced this in varying degrees throughout your career - there's rarely a clear-cut, single answer to anything we do. I'm not sure it benefits anyone much to world such a broad cudgel as to call a tool like this unhelpful because of your preference.

I'd imagine we could think of a dozen other reasons for and against this over a coffee. Maybe we will get to one day!

Collapse
 
33nano profile image
Manyong'oments

Awesome, definitely going to use it.

Collapse
 
irreverentmike profile image
Mike Bifulco

Sweet! I'd love to hear what you think. It's been super useful to me.

Collapse
 
dploeger profile image
Dennis Ploeger

Awesome. Thanks for pointing that out. I didn't know about that tool.

Collapse
 
irreverentmike profile image
Mike Bifulco

Glad you found it helpful!

Collapse
 
premedios profile image
Pedro Remedios

This tool does not invalidate all the manual guess work that was done before this existed!

Collapse
 
irreverentmike profile image
Mike Bifulco

Of course not, but it definitely helps smooth out the workflow now. You also benefit from the work of the community this put this together - which is one of the things I really love about open source software. If you feel particularly strongly about the way you organized your .gitignore files in the past, why not submit your work as a pull request?

Collapse
 
jamesbright profile image
James Ononiwu

cool, i didn't know this exist.

Collapse
 
xmariopereira profile image
Mario Pereira

IntelliJ (or any jet brains product) already does that for you.

Collapse
 
irreverentmike profile image
Mike Bifulco

Always more than one way to skin a cat!