[英]How to ignore obj folder using Git under MS Windows
I have got following path that I need to exlcude to commit with Git 我已经遵循了我需要向Git提交的路径
C:\Projects\GitHub\MyProjects\TED\SourceCode\Presentation\REXI.Web\obj
Everything is under C:\\Projects\\GitHub\\
is cloned Git repository. 一切都在C:\\Projects\\GitHub\\
是克隆的Git存储库。
And at the same folder I have got .gitignore
在同一文件夹中,我有.gitignore
C:\Projects\GitHub\.gitignore
So which pattern I have to use to exclude obj
folder? 那么我必须使用哪种模式排除obj
文件夹?
Thank you! 谢谢!
obj
to ignore all obj
folders or files ever. obj
忽略所有obj
文件夹或文件。
obj/
to ignore all obj
folders ever. obj/
忽略所有obj
文件夹。
MyProjects/TED/SourceCode/Presentation/REXI.Web/obj
to ignore just that obj folder. MyProjects/TED/SourceCode/Presentation/REXI.Web/obj
仅忽略该obj文件夹。
MyProjects/TED/SourceCode/Presentation/REXI.Web/obj/**/*
to ignore everything in that obj folder. MyProjects/TED/SourceCode/Presentation/REXI.Web/obj/**/*
忽略该obj文件夹中的所有内容。 Since empty folders are never committed this amounts to the same as the previous for the most part however it allows you to do: 由于绝不会提交空文件夹,因此在大多数情况下,这与以前的文件夹相同,但是它允许您执行以下操作:
!MyProjects/TED/SourceCode/Presentation/REXI.Web/obj/do_commit_this_one
to make an exception where the do_commit_this_one
file is committed. !MyProjects/TED/SourceCode/Presentation/REXI.Web/obj/do_commit_this_one
会导致提交do_commit_this_one
文件的异常。
As an example, I tend to start my .NET projects with a .gitignore of: 例如,我倾向于以.gitignore开头的.NET项目:
logs
obj
bin
*.userprefs
packages/**/*
!packages/repositories.config
geany_run_script.bat
And if I'm using SASS on an ASP.NET project, then also: 并且,如果我在ASP.NET项目上使用SASS,那么:
.sass-cache
*.map
*.css
As such, it ignores all folders called logs
, obj
, bin
or .sass-cache
(side-effect folder of SASS). 这样,它会忽略所有称为logs
, obj
, bin
或.sass-cache
文件夹(SASS的副作用文件夹)。 It ignores the contents of all folders called packages
except for files immediately inside such folders called repositories.config
. 它会忽略所有称为packages
的文件夹的内容,除了这些文件夹内紧接的文件(称为repositories.config
之外的文件。 It ignores all files called geany_run_script.bat
(side-effect file of Geany) and all files ending in *.map
or *.css
(I can add exceptions for any static CSS files). 它会忽略所有名为geany_run_script.bat
文件(Geany的副作用文件)以及所有以*.map
或*.css
结尾的文件(我可以为任何静态CSS文件添加例外)。
It worth noting that there is a repository on github that maintain .gitignore
file for a lot of languages. 值得注意的是,在github上有一个存储库,可以为多种语言维护.gitignore
文件。 Here is the one that could suit you (where obj, bin and other visual studio or Windows files are ignored) : visual studio 这是一种适合您的文件(其中obj,bin和其他Visual Studio或Windows文件将被忽略): visual studio
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.