更新时间:2022-12-04 17:00:36
不幸的是,除了Ted提到的一种方法之外,没有其他方法可以自动执行此操作. 但是,就我个人而言,我认为这并不是一个很大的缺点,因为您可以安全地添加最适合您的项目的特定模板. 为此,请执行以下操作:
Unfortunately, there is no way to do that automatically, besides the one Ted has mentioned. However, personally, I don't see this as a big downside, because you can thus safely add your specific templates that fit best to your project. To be able to do this, do the following:
转到File -> Settings
,然后从其中突出显示Plugins
.单击Browse repositories...
,您应该可以找到名为 .ignore 的插件.安装它.
Go to File -> Settings
and from there highlight Plugins
. Click on Browse repositories...
and you should be able to find the plugin entitled .ignore. Install it.
现在要为任何项目配置.gitignore
,如果您没有打开任何项目,请单击Configure
-> Settings
.如果您有一个打开的项目,请转到File -> Other Settings -> Default Settings…
.现在展开Version Control
并单击Ignore Files Support
.您应该可以在其中添加.gitignore
文件的自定义用户模板.
Now to configure a .gitignore
for any project, in case you have no project opened, click on Configure
-> Settings
. In case you have an open project, go to File -> Other Settings -> Default Settings…
. Now expand Version Control
and click on Ignore Files Support
. You should be able to add a custom user template of your .gitignore
-file there.
要使用添加到此处的任何模板,只需右键单击.gitignore
,然后单击Add template…
.您可以在其中添加自定义规范,但是默认情况下会提供许多其他规范,因此您无需在Google上搜索操作系统或特定于语言的.gitignore
配置.
To use any template you've added there, just right click on your .gitignore
and click on Add template…
. There you'll be able to add your custom specifications, however, many others are given by default, so you don't need to do a google search for an OS or language specific .gitignore
configuration.