Using Nettuts-Fetch to create .gitignore files in Sublime Text

When creating a new repository, the first step is to create a .gitignore file. Simple enough, right? Well, that is until your team members start contributing code and adding unusal files because you’ve forgotten they use that editor.

I use a simple method to get around this problem. I host .gitignore files on GitHub. This means anyone on my team can contribute: if they install a new editor, they just add any editor-related files to the repo (or any other files that need to excluded from the repository).

I then use the Sublime Text plugin Nettuts-Fetch to quicky create the .gitignore file.

To set this up, create a GitHub repository to host your .gitignore files. I currently have two: a standard .gitignore file and a WordPress .gitignore file. You can have as many as you need.

Next, install the Nettuts-Fetch plugin. Once installed, bring up the command palette and select ‘Fetch: Manage’. A json file will open, just enter something like the following in the files section:

	"gitignore - standard": "",
	"gitignore - wordpress": ""

Change the names and repository paths as required. Next, create a new file and then open the command palette and select ‘Fetch: File’. You can then select the .gitignore file you require (as shown below). Save the file as .gitignore and you’re done.

Sublime Text Fetch Plugin

Related articles

Where to go next

1. If you'd like to discuss working together, I'd love to hear from you. Even if you don't have a specific project in mind, but would like to start the relationship for when you do, go introduce yourself.

2. If you enjoyed this article, why not share it on Twitter, Facebook or LinkedIn?

3. If you want to get my writing delivered to your inbox, subscribe to my newsletter. I only send out one email per month and you're free to unsubscribe at any time.

4. If you're on the socials, you can follow me on Twitter @marcjenkins or send a request on LinkedIn.