用于 Android Studio 项目的 Mercurial .hgignore [英] Mercurial .hgignore for Android Studio projects

查看:27
本文介绍了用于 Android Studio 项目的 Mercurial .hgignore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 Android Studio (1.0 RC4 Windows) 进行开发时,Mercurial 中应该忽略哪些文件?

What files should be ignored in Mercurial when using Android Studio (1.0 RC4 Windows) for development?

创建新的应用程序项目也会创建 .gitignore 文件.我已将其转换为以下 .hgignore 文件

Creating new application project also creates .gitignore file. I have translated that to following .hgignore file

syntax: glob
.hgignore
.gradle
local.properties
.idea/workspace.xml
.idea/libraries
.DS_Store
build

但是当我为我的项目执行 Add to VCS 时,一些不在忽略列表中的文件不会被添加到 Mercurial.遗漏的文件是:

But when I do Add to VCS for my project, some files that are not in ignore list are not being added to Mercurial. Files left out are:

.idea\.name
.idea\compiler.xml
.idea\copyright\profiles_settings.xml
.idea\encodings.xml
.idea\gradle.xml
.idea\misc.xml
.idea\modules.xml
.idea\scopes\scope_settings.xml
.idea\vcs.xml
build.gradle
MyApplication.iml
gradle.properties
gradle\wrapper\gradle-wrapper.jar
gradle\wrapper\gradle-wrapper.properties
gradlew
gradlew.bat
settings.gradle

我应该将这些文件添加到忽略列表,还是应该将它们添加到 VCS?

Should I add those files to ignore list, or should I add them to VCS?

目前还不清楚应该对 .iml 文件做什么.使用 AS 将项目添加到 Mercurial 将添加 app\app.iml 文件,但使用 AS 将项目添加到 Git 将不会跟踪该文件.

It is also unclear what should be done with .iml files. Adding project to Mercurial using AS will add app\app.iml file, but adding project to Git using AS will leave that file untracked.

我不想在 VCS 中跟踪多余的文件,但我不想错过存储重要文件.应该跟踪哪些文件的来源有很多,但信息千差万别,很难下定论.

I don't want to track superfluous files in VCS, but I don't want to miss storing important ones. There are numerous sources on which files should be tracked, but information differs so greatly it is hard to make any definite conclusion.

更新:我的.hgignore文件的最终版本

syntax: glob
.hgignore
.gradle
local.properties
.idea
.DS_Store
build
*.iml
gradlew
gradlew.bat

为了在开发人员之间共享项目,必须将以下文件提交到 VCS 或 AS 将无法在另一台机器上导入项目:

For sharing project among developers following files have to be commited to VCS or AS will not be able to import project on another machine:

gradle.properties
gradle\wrapper\gradle-wrapper.jar
gradle\wrapper\gradle-wrapper.properties

推荐答案

我建议你将上面列出的所有文件添加到 .hgignore 中,除了 build.gradlesettings.gradle..idea 目录中的文件由 Android Studio 自动生成,您不应跟踪它们或手动编辑它们.我认为您永远不需要编辑 gradlewgradlew.bat 以便您也可以输入它们.您可以稍后添加 gradle.propertiesgradle-wrapper.properties ,当您需要更改默认版本时(就个人而言,我也忽略了这两个).

I suggest you add all the files listed above to .hgignore except for the build.gradle and settings.gradle. The files in .idea directory are generated automatically by Android Studio and you shouldn't track them, or manually edit. I don't think you will ever need to edit gradlew or gradlew.bat so you can ingore them also. You can add gradle.properties and gradle-wrapper.properties later, when you will need to change the default versions (personally, I've these two to ignore also).

这篇关于用于 Android Studio 项目的 Mercurial .hgignore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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