Skip to content

Instantly share code, notes, and snippets.

@sheriffderek
Created May 30, 2019 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sheriffderek/c98fc9e8703251409954e7ac6e871c2d to your computer and use it in GitHub Desktop.
Save sheriffderek/c98fc9e8703251409954e7ac6e871c2d to your computer and use it in GitHub Desktop.
WordPress .gitignore to allow only theme and plugins in repo
# Blacklist files/folders in same directory as the .gitignore file
/*
# Whitelist some files
!.gitignore
!README.md
# Ignore all files named .DS_Store or ending with .log
**/.DS_Store
**.log
# Whitelist folders
# yes to folder -> no to contents & repeat... kinda ugly - but gets the job done
# !/folder-name - allow-this-folder
# /folder-name/* - disallow everything in it
!/wp-content
/wp-content/*
# Up to you... but saves a lot of hassle
!/wp-content/plugins
# For shared resources mysite.com/resources/video/how-to.mp4 etc.
!/resources
# Add your theme name below (I like to use `company-name-2019` or something)
!/wp-content/themes
/wp-content/themes/*
!/wp-content/themes/your-theme-name-here
@sheriffderek
Copy link
Author

You'll need to rename the file .gitignore and put it in the root of your project folder / with the .git folder.
( note: command+shift+period to see hidden files in the finder (mac) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment