Search code examples
gitgitignore

exclude only js files from gitignore


I'm now working on a project and I am going to change the .js files of this project. I want to track my changes on this project and I want to have a git repository which have only the .js files.

this .js files can be in any folder in this project with any depth.

I try this in my .gitignore file but have no luck:

/*
!/*.js

can you put me in a right direction? thank you.


Solution

  • Add these two lines to your .gitignore inside root directory of your repository. It should then probably track only .js files.

    *.*
    !*.js