I want to exclude in .gitignore
:
admin
folder completelycontent
folder completely, but only allow .php
and .js
extensions in there.I tried this, but it also allows in admin:
**/admin
**/content
!.php
!.js
Try ignoring folders (afolder/
with trailing slash), but whitelisting folder files (afolder/*
):
admin/
content/*
!content/subfolder/**/*.php
!content/subfolder/**/*.js
Adding a dedicated .gitignore
in content/
folder is another option, but that way, you can centralize all ignore rules in one .gitignore
file at the root folder of your main repository.
As usual, to check what rule is applied:
git check-ignore -v -- a/file