Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress project .gitignore
# ignore everything in the root except the "wp-content" directory.
/*
!wp-content/
# ignore everything in the "wp-content" directory, except:
# mu-plugins, plugins, and themes directories
wp-content/*
!wp-content/mu-plugins/
!wp-content/plugins/
!wp-content/themes/
# ignore all mu-plugins, plugins, and themes
# unless explicitly whitelisted at the end of this file
wp-content/themes/*
# ignore index.php in plugins folder
wp-content/plugins/index.php
# ignore all files starting with . or ~
.*
~*
# ignore node dependency directories (used by grunt)
node_modules/
# ignore OS generated files
ehthumbs.db
Thumbs.db
# ignore Editor files
*.sublime-project
*.sublime-workspace
*.komodoproject
*.codekit3
.idea
# ignore log files and databases
*.log
*.sql
*.sqlite
# ignore compiled files
*.com
*.class
*.dll
*.exe
*.o
*.so
# ignore packaged files
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# -------------------------
# BEGIN Whitelisted Files
# -------------------------
# track these files, if they exist
!.gitignore
!.editorconfig
!.scss-lint.yml
!README.md
!CHANGELOG.md
!composer.json
# track these themes
!wp-content/themes/theme_name/
@thebigtine

This comment has been minimized.

Copy link

@thebigtine thebigtine commented May 10, 2019

I would suggest adding *.codekit3

@mikedamoiseau

This comment has been minimized.

Copy link

@mikedamoiseau mikedamoiseau commented Jun 8, 2020

I would add .idea to the list

@vanduc1102

This comment has been minimized.

Copy link

@vanduc1102 vanduc1102 commented Jun 16, 2020

i want to ignore dist folder in my theme.
wp-content/themes/my-theme/dist
the dist is a result of webpack build

@thebigtine

This comment has been minimized.

Copy link

@thebigtine thebigtine commented Jun 16, 2020

i want to ignore dist folder in my theme.
wp-content/themes/my-theme/dist
the dist is a result of webpack build

@vanduc1102 use: wp-content/themes/my-theme/dist/*

@jasewarner

This comment has been minimized.

Copy link
Owner Author

@jasewarner jasewarner commented Jun 16, 2020

@mikedamoiseau, I've added .idea. Thanks for the suggestion.

@jasewarner

This comment has been minimized.

Copy link
Owner Author

@jasewarner jasewarner commented Jun 16, 2020

@josephbydeign, a (very) belated thanks for the *.codekit3 suggestion and also for helping out @vanduc1102.

@thebigtine

This comment has been minimized.

Copy link

@thebigtine thebigtine commented Jun 16, 2020

@jasewarner you're welcome 😄

@vanduc1102

This comment has been minimized.

Copy link

@vanduc1102 vanduc1102 commented Jun 16, 2020

it doesnt work @jose,
here is my code

wp-content/*
!wp-content/mu-plugins/

!wp-content/plugins/
wp-content/plugins/*
!wp-content/plugins/p-a/

!wp-content/themes/
wp-content/themes/*
!wp-content/themes/theme-a/
wp-content/themes/theme-a/dist/*
!wp-content/themes/theme-b/

After commit the .gitignore and run git update-index
I'm still seeing files in dist/* as tracked
------- UPDATED --------
my bad, the dist was tracked, I need to delete the dist folder and commit them,
the code above works well, thanks @josephbydeign

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