Creating .gitignore Files the Easy Way #
If you’re a programmer, you’re probably aware about version control and Git, and maybe even what a
.gitignore file is.
If you don’t:
A gitignore file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected; see the NOTES below for details.
Anyway, creating these files can be annoying to write manually, and there a bunch of templates all over the internet to make this much easier.
I however, found a much better solution for creating these files, and it’s gitignore.io. It’s a website that you can use to generate a
.gitignore file, but also a command line tool that you can use, so you never have to leave your terminal.
It has support for operating systems, IDEs, and programming languages. So my standard file will be generated from macOS, Xcode, and Swift, since that’s how I roll.
You can type (with autofill of course) whatever templates you want to make use of straight into the website, and then hit ‘Create’.
For the command line, you’ll have to first install it, and then the
gi command will be available. All you need to do is type
gi followed by a comma-separated list of the same items you would use on the website.
So mine would be:
The command would of course, output this out via the standard output, so you can direct it straight into your
.gitignore file by writing something like:
gi macos,xcode,swift >> .gitignore
It’s super easy, and it saves a lot of time.
As a little bonus, there’s also a quick video on how to install and use the command line tool.