创建新项目时更改默认的 gitignore 文件 [英] Change default gitignore file when creating a new project

查看:27
本文介绍了创建新项目时更改默认的 gitignore 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法更改 Android Studio 在创建新的 android 项目时创建的默认文件 .gitignore?我在设置中搜索它,但找不到任何东西.

Is there a way to change the default file .gitignore that Android Studio creates when creating a new android project? I searched for it in the Settings but could not find anything.

推荐答案

不幸的是,除了 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:

转到<代码>文件->设置,然后突出显示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 ->其他设置 ->默认设置....现在展开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....您可以在那里添加您的自定义规范,但是,默认情况下会提供许多其他规范,因此您无需在谷歌搜索特定于操作系统或语言的 .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.

这篇关于创建新项目时更改默认的 gitignore 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆