我应该在 Android Studio 中对 app/build 个文件进行版本控制吗?

Should I version app/build files in Android Studio?

我是 Git 和 Android 开发的新手,我找不到这个问题的答案。

当我在 Android Studio 中构建项目时,会在文件夹 app/build.

中创建很多文件

我想我不需要那些文件,但在 .gitignore 中忽略它们之前,我想确保从第一次提交开始就不会弄乱我的回购协议 :D

我检查了 this question,但在示例 .gitignore 中看不到文件夹 app/build

我应该将它添加到我的 .gitignore 吗?

P.S。我正在使用 Android Studio 2.2.3,如果相关的话

I guess I don't need that files, but before ignoring them in the .gitignore I would like to be sure to not mess my repo since from the first commit :D

您的存储库中不需要 build 个文件。

通常 .gitignore 文件包含 /build.

I checked this question but I cannot see in the example .gitignore the folder app/build.

你可以再放置一个.gitignore文件到app目录下,这个文件的内容还包含/build.

/project
     .gitignore
     /app
         .gitignore

查看 gitignore.io 以生成 gitignore 文件

If I copy/past the example .gitignore (which contains build/ ) in the app/ folder, build files are not ignored.

那是因为这些文件已经被跟踪。

尝试:

cd app
git rm --cached -r build/
git add .
git commit -m "record build content deletion"
git push

那么app/build将被忽略。