gitignore

Creating a repository for code with Git means you want to track changes that are made to that code. Git works by tracking files in the folder it’s set up in.

Often, though, there’s more than just code that is included in the folders. For instance, for a website, there’s content like blog posts and pictures.

It is important to remember that git is for tracking and saving code. It’s not suited to tracking and saving content. For that, you’d need a back-up system that will work more efficiently.

To tell git not to track some of the sub-folders, files or datasets, you create a gitignore file. In it, you specify which individual files to exclude from tracking. You can also specify patterns, to exclude groups of files that have matching filenames. Lastly, you can specify entire subfolders.

The file itself is simply a file called “.gitignore” and each line is a new entry:

# Exclude these files from the git repository
wp-content/backup/*
wp-content/cache/*
wp-content/upgrade/*
wp-content/uploads/*
sitemap.*

Sources:

http://stevegrunwell.github.io/wordpress-git/#/

Keeping WordPress Under [Version] Control with Git