I tried this .gitignore file:
*
!mydirectory.ext
!.gitignore
But it's not working, everything except the gitignore is ignored.
Also tried:
!\mydirectory\.ext
The directory needs an extension because its a plugin for an app.
Any workarounds?