如何从 git 中排除打字稿编译文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33958140/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to exclude typescript compiled files from git
提问by Luca Morelli
I have a visual studio solution with a few asp.net 5 project. Inside every project I have a wwwrootdirectory and inside this an appdirectory 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 .mapfiles, inside every subdir of the wwwroot\appdirectory of every project in the solution are ignored?
我有一个包含一些 asp.net 5 项目的 Visual Studio 解决方案。在每个项目中,我都有一个wwwroot目录,其中有一个app目录,其中包含 html 视图、.js 和 .map 文件,这些文件是在此位置编译的打字稿文件。
使用标准配置,这些文件包含在检入中。如何配置 .gitignore 文件,以便忽略解决方案中每个项目的wwwroot\app目录的每个子目录中的所有.js 和 .map文件?
回答by crea1
wwwroot/app/**/*.js
wwwroot/app/**/*.map
The **
will match everything inside app
, also multiple levels of subdirectories.
在**
将匹配里面的一切app
,也是多个子目录的水平。
回答by Sergio
Add the following lines to your .gitignore:
将以下行添加到您的 .gitignore:
# Ignores compiled TypeScript files
**/wwwroot/app/**/*.map
**/wwwroot/app/**/*.js
You can read more about gitignore and supported patterns here.
您可以在此处阅读有关 gitignore 和支持的模式的更多信息。
**
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
在 wwwroot\app 目录的每个子目录中