我使用 .gitignore 文件在 Android Studio 中创建了项目。
.DS_Store
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
out/
gen/
# Libraries used by the app
# Can explicitly add if we want, but shouldn't do so blindly. Licenses, bloat, etc.
/libs
# Build stuff (auto-generated by android update project ...)
build.xml
ant.properties
local.properties
project.properties
# Eclipse project files
.classpath
.project
# idea project files
.idea/
.idea/.name
*.iml
*.ipr
*.iws
##Gradle-based build
.gradle
build/
在此之后我使用了
git init
项目目录下的命令。git status
命令git add .
和 git status
命令git commit
命令git status
具有空值的命令Git 的版本是 1.9.1。我不明白为什么将这些文件添加到提交中。
最佳答案
可能,这是 1.9.1 版本中的一个错误。
你应该更新git。
Git v2.0 Release Notes
Updates since v1.9 series
- Trailing whitespaces in .gitignore files, unless they are quoted for fnmatch(3), e.g. "path\ ", are warned and ignored. Strictly speaking, this is a backward-incompatible change, but very unlikely to bite any sane user and adjusting should be obvious and easy.
Git v2.1 Release Notes
Fixes since v2.0
- Mishandling of patterns in .gitignore that have trailing SPs quoted with backslashes (e.g. ones that end with "\ ") has been corrected. (merge 97c1364be6b pb/trim-trailing-spaces later to maint).
Git 2.5 Release Notes
Fixes since v2.4
- The codepaths that read .gitignore and .gitattributes files have been taught that these files encoded in UTF-8 may have UTF-8 BOM marker at the beginning; this makes it in line with what we do for configuration files already. (merge 27547e5 cn/bom-in-gitignore later to maint).
关于git - 为什么 .gitignore 不适用于 Android Studio 中的新项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38130646/