Sample gitignore

Featured in: Git Push with WPEngine

This uses a single repo for all custom code on a website – typically a theme and a core functionality plugin. I initialize git in the top level directory along with this .gitignore file:

# Ignore everything #
**
!wp-content/
wp-content/**
!wp-content/themes/
!wp-content/plugins/
wp-content/themes/**
wp-content/plugins/**

# Add two rules for each Theme or Plugin you want to include:
# 1. !folder-name/    <-- includes the Plugin and top level files
# 2. !folder-name/**  <-- includes the Plugin and sub level files recursively, except for the "Ignore some other system generated files" rules below
###############################

# Start editing!

# Theme
!wp-content/themes/my-custom-theme/
!wp-content/themes/my-custom-theme/**

# Functionality Plugin
!wp-content/plugins/core-functionality/
!wp-content/plugins/core-functionality/**


# Stop editing!

############################################
# Ignore some other system generated files #
############################################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.log
*.sql
*.sqlite
.DS_Store
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
.codekit-cache
.sass-cache
# Sublime
*.sublime-project
*.sublime-workspace
# PhpStorm
.idea/

# Always include the build script #
###################################
!build.sh
!README.md
!CHANGELOG.md
!.gitignore

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk