File Structure:
I want to ignore all .js files except file.js(which is present in both folders with same name). So, in my gitignore, I tried the following:
Option 1:
!*file.js
*.js
Option 2:
!/*/file.js
*.js
Option 3:
!/Folder1/file.js
!/Folder2/file.js
*.js
But always only the file.js in Folder1 is included with all 3 options, and file.js in Folder2 is always ignored. Other js files in both folders are ignored perfectly. What am I doing wrong here?
You want the global *.js
at the top. By putting *.js at the bottom it overrides the excludes above it.
*.js
!Folder1/file.js
!Folder2/file.fs