I have a directory structure similar to bedrock. So WordPress in its own subdirectory wp/ and the stuff that normally goes into wp-content is in app/. I want to exclude all directories in app/ BUT uploads/.
But inside uploads/ itself I want to exclude every image that was automatically generated by WordPress. So every file that follows the pattern $original_image_name-$widthx$height.$ext.
I tried the different solutions from all the already asked questions there are and my current (still not working) .gitignore looks like this now:
.gitignore
# WordPress
public/wp/
public/app/*
!public/app/uploads
public/app/uploads/*-*x*.* # auto-generated sizes
When checking git status public/app/uploads/ it still shows the auto-generated files as Untracked files along with the other images.