从 Android Studio 中的 Gradle 项目提交到 VCS 的内容
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22219505/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What to commit into VCS from a Gradle project in Android Studio
提问by helleye
I am using Android Studio 0.4.6 and Gradle 1.10. I want to commit into git the necessary files and folders, so that anyone cloning the repository can start working with the project and will not have any issues of missing files/settings because of not commited file. Could someone point what is needed to be into VCS and what is optional.
我使用的是 Android Studio 0.4.6 和 Gradle 1.10。我想将必要的文件和文件夹提交到 git 中,以便克隆存储库的任何人都可以开始使用该项目,并且不会因为未提交的文件而出现任何丢失文件/设置的问题。有人可以指出VCS需要什么以及什么是可选的。
From question: "gradle directory in an Android Studio project" I see that the gradle/ folder is good to have it, but what about .idea/, .gradle/, gradlew.bat etc... I see inside local.properties that it should not be commited, but what about everything else?
从问题:“ Android Studio 项目中的 gradle 目录”我看到 gradle/ 文件夹很好,但是 .idea/、.gradle/、gradlew.bat 等呢...我在 local.properties 中看到它不应该被提交,但其他一切呢?
Here is my .gitignore that works perfect for me now:
这是我的 .gitignore 现在非常适合我:
/app/build
.idea/workspace.xml
.idea/tasks.xml
.gradle
local.properties
采纳答案by Jesper Riemer Andersen
You can take a look at What should be in my .gitignore for an Android Studio project?
您可以查看我的 .gitignore 中的 Android Studio 项目应该包含哪些内容?
If you use the .gitignore file from that questions you shouldn't have any problems.
如果您使用这些问题中的 .gitignore 文件,您应该不会有任何问题。
I think that if you create a new project inside a git directory Android Studio will automatically create the necessary .gitignore files for your project.
我认为如果您在 git 目录中创建一个新项目,Android Studio 会自动为您的项目创建必要的 .gitignore 文件。
EDIT:Actually it seems that my Android Studio always generates .gitignore files when I create a project.
编辑:实际上,当我创建项目时,我的 Android Studio 似乎总是生成 .gitignore 文件。