How to ignore js files in a specific subfolder?

I have the following structure

structure

I want to say .gitignore ignore js , map file types.

I tried the following

 # ========================= # Web essentials auto-generated files # ========================= TypeScript.Content/Scripts/*.js TypeScript.Content/Scripts/*.js.map 

But when I change the js file (or "create" it), it adds to the list of pending changes ...

Something is wrong?

+4
source share
1 answer

It seems that the .js and .map files that you want to ignore git are already in the index. You must tell git to cancel these files:

 git rm --cached TypeScriptTest.Content/Scripts/*.js git rm --cached TypeScriptTest.Content/Scripts/*.js.map 

Quote from GitHub's Help on Ignoring Files :

Note that git will not ignore a file that has already been tracked until a rule has been added to this file to ignore it.

+7
source

Source: https://habr.com/ru/post/1488930/


All Articles