-
-
Save jasewarner/0b4baf4d0fc2388039e73722cc7fcee2 to your computer and use it in GitHub Desktop.
# ignore everything in the root except the "wp-content" directory. | |
/* | |
!wp-content/ | |
# ignore everything in the "wp-content" directory, except the themes directories | |
wp-content/* | |
!wp-content/themes/ | |
# ignore all mu-plugins, plugins, and themes | |
# unless explicitly whitelisted at the end of this file | |
wp-content/themes/* | |
# 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/ |
I would add .idea
to the list
i want to ignore dist
folder in my theme.
wp-content/themes/my-theme/dist
the dist
is a result of webpack
build
i want to ignore
dist
folder in my theme.
wp-content/themes/my-theme/dist
thedist
is a result ofwebpack
build
@vanduc1102 use: wp-content/themes/my-theme/dist/*
@mikedamoiseau, I've added .idea
. Thanks for the suggestion.
@josephbydeign, a (very) belated thanks for the *.codekit3
suggestion and also for helping out @vanduc1102.
@jasewarner you're welcome 😄
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
For those of you having issues with the gitignore still not working. The reason is because the git has cached that gitignore.
So what you should do is clear the gitignore cache within your git installation, by doing so:
git rm --cached -r . && git add .
That way you can ensure that if you want to ignore a file but it is not working, then the reason is because gitignore has cached that file to still be present in your future commits. By clearing the gitignore cache you are able to effectively ignore the files to follow your gitignore.
Yes, I said gitignore 7 times.
I would suggest adding *.codekit3