How can i exclude everything but only specific directory to publish git by using .gitignore
-node_modules
-js
-ts
-releases
-package.json
I want to only add releases folder and all contents to my git branch.
*
!releases
*
!releases/
It sounds like you're trying to ignore everything by default but whitelist certain directories. If so you may find this post helpful:
https://jasonstitt.com/gitignore-whitelisting-patterns
For your scenario you may want to try adding a double wildcard (to allow traversal below that folder) at the end of the folder you want to include like this:
*
!folder_name/**