Luca Morelli
Luca Morelli

Reputation: 2560

how to exclude typescript compiled files from git

I have a visual studio solution with a few asp.net 5 project. Inside every project I have a wwwroot directory and inside this an app directory that contains the html views, .js and .map files that are typescript files compiled in this position.
With the standard configuration these files are included in the checkin. How can configure the .gitignore file so all the .js and .map files, inside every subdir of the wwwroot\app directory of every project in the solution are ignored?

Upvotes: 38

Views: 27994

Answers (2)

Sergio
Sergio

Reputation: 681

Add the following lines to your .gitignore:

# Ignores compiled TypeScript files
**/wwwroot/app/**/*.map
**/wwwroot/app/**/*.js

You can read more about gitignore and supported patterns here.

** matches subdirectories recursively. The first one is there for the projects, the second one is there because you mentioned

inside every subdir of the wwwroot\app directory

Upvotes: 23

crea1
crea1

Reputation: 12557

wwwroot/app/**/*.js
wwwroot/app/**/*.map

The ** will match everything inside app, also multiple levels of subdirectories.

Upvotes: 46

Related Questions