Generate a .gitignore file right from the command-line
Usually one of the first things I do after creating a new Git repo for a project is to put together my .gitignore file. This often involves copy/pasting from a previous project, or visiting github/gitignore.
However, thanks to gitignore.io, you can simply add a function to your command-line environment that makes it easy to quickly grab the .gitignore file you need.
For example, for an iPhone project, after initializing my repo, I can just run the following command:
gi objective-c >> .gitignore
…and a sparkly new ignore file will be created for me and is ready to use. You can find full instructions on how to use gitignore.io and set it up for command-line use at http://gitignore.io/cli.
Written by Josh Buhler
Related protips
4 Responses
hi @joshbuhler,
related to your topic, I published this one : A git extension to manage .gitignore files
I've just shared another CLI to manage .gitignore files that provides more features. You can take a look if you are interested : gitignore-cli
best regards
Eric
You mentioned github, anyone working on a project they're going to host on github you should know that when you create a new repository, you can create it with a .gitignore
file that you select for the particular language/platform you're going to use.
@smathy - That's a good reminder. I'd actually forgotten that GitHub can create the ignore file for you when you create a new repo. I don't host all my repos there though, and the ones I do publish eventually usually start out locally on my machine for at least a few commits before they do make it to GH. Still a good reminder of that feature though.
why not?
curl http://gitignore.io/api/objective-c > .gitignore