BrunoLM
BrunoLM

Reputation: 100312

How to ignore js files on a specific subfolder?

I have the following structure

structure

I want to tell .gitignore to 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...

Is something wrong?

Upvotes: 7

Views: 3322

Answers (1)

devnull
devnull

Reputation: 123448

It seems that the .js and .map files that you wish git to ignore are already present in the index. You need to tell git to un-track those files:

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

Quote from GitHub help on Ignoring files:

Note that git will not ignore a file that was already tracked before a rule was added to this file to ignore it.

Upvotes: 9

Related Questions