Screenshot of gitignore.io

Git is becoming more and more popular beyond traditional users of version control systems thanks to the widespread availability of git-based WordPress staging areas provided by several managed WordPress Hosting Platforms (like the one by WPEngine).

Therefore, we have two main kinds of WordPress user profiles that can benefit from Git:

  • WordPress developers (i.e. plugin authors) that use Git to keep track of all the file changes done during the development process
  • WordPress designers that use Git to work on the design of new sites in a local environment or staging area to move it to the production environment once it’s ready.

Both use Git in a slightly different way (e.g. designers track a WordPress installation while developers track a development project) but share a common issue with all Git users: the need to define which files should NOT be check in to the repository. A typical example would be an .htaccess file configured for your local testing environment. If you inadvertently add it to the repository, if will overwrite the local configuration of your coworkers, causing a mess.

Since the files to ignore depend on the kind of project you are tracking (and even on the specific tools you use in the project, e.g., the files to ignore are not the same whether you’re using PhpStorm or Eclipse for the development), determining the right set of files to ignore is not an easy task.

And even if you know the files / paths to ignore, listing them as Git expects is not an easy task either. Files to ignore in Git must be listed in a specific file called .gitignore. Take a look at the (complex) syntax rules you could use for that.

Gitignore.io aims at solving both problems by generating for you the right .gitignore file for your kind of project. You can choose your favourite PHP/CSS/Javascript IDE if developing a new plugin/theme or just ‘WordPress‘ if working on a new site design and you’ll immediately get the .gitignore file your project is missing. You can obviously download the file and tailor it to your specific configuration if needed.

For instance, this is the .gitignore file for WordPress as generated by gitignore.io:

# Created by https://www.gitignore.io
### WordPress ###
*.log
.htaccess
sitemap.xml
sitemap.xml.gz
wp-config.php
wp-content/advanced-cache.php
wp-content/backup-db/
wp-content/backups/
wp-content/blogs.dir/
wp-content/cache/
wp-content/upgrade/
wp-content/uploads/
wp-content/wp-cache-config.php

And in case gitignore.io does not support your specific environment you may want to browse the official collection of .gitignore templates provided by GitHub.

Leave a Reply

Your email address will not be published. Required fields are marked *

I have read and agree to the Nelio Software Privacy Policy

Your personal data will be located on SiteGround and will be treated by Nelio Software with the sole purpose of publishing this comment here. The legitimation is carried out through your express consent. Contact us to access, rectify, limit, or delete your data.