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

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

问题描述

在创建新的android项目时,是否可以更改Android Studio创建的默认文件.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:

转到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.

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

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