Skip to content

Instantly share code, notes, and snippets.

@jamiebergen
Last active April 29, 2025 17:26
Show Gist options
  • Save jamiebergen/91a49b3c3e648031619178050122d90f to your computer and use it in GitHub Desktop.
Save jamiebergen/91a49b3c3e648031619178050122d90f to your computer and use it in GitHub Desktop.
Gitignore whitelist approach #git
# Blacklist files/folders in same directory as the .gitignore file
/**
# Whitelist some files
!.gitignore
!wp-content/
wp-content/**
!wp-content/themes/
wp-content/themes/**
!wp-content/plugins/
wp-content/plugins/**
# Track active themes #
!wp-content/themes/twentyeleven-child/
!wp-content/themes/twentyeleven-child/**
!wp-content/themes/decker-new-book/
!wp-content/themes/decker-new-book/**
# Ignore _old directory #
wp-content/themes/twentyeleven-child/_old
wp-content/themes/decker-new-book/_old
# Track WooCommerce #
!wp-content/plugins/woocommerce/
!wp-content/plugins/woocommerce/**
# Ignore system-generated files and images #
.DS_Store
Icon*
*.png
*.jpg
*.gif
*.pdf
# 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
# Blacklist files/folders in same directory as the .gitignore file
/**
# Whitelist some files
!.gitignore
!wp-content/
wp-content/**
!wp-content/themes/
wp-content/themes/**
# Track active theme #
!wp-content/themes/red_underscores/
!wp-content/themes/red_underscores/**
# Ignore system-generated files #
.DS_Store
Icon*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment