【问题标题】:Why .gitignore not working for the new project in Android Studio?为什么 .gitignore 不适用于 Android Studio 中的新项目?
【发布时间】:2016-06-30 18:22:48
【问题描述】:

我在 Android Studio 中使用 .gitignore 文件创建了项目。

.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。我不明白为什么这些文件添加到提交。

【问题讨论】:

    标签: git android-studio gitignore


    【解决方案1】:

    应该是1.9.1版本的bug吧。

    你应该更新 git。

    Git v2.0 Release Notes

    自 v1.9 系列以来的更新

    • .gitignore 文件中的尾随空格,除非它们被引用 对于 fnmatch(3),例如“路径\”,被警告并被忽略。严格 说,这是一个向后不兼容的变化,但不太可能 咬住任何理智的用户,调整应该是显而易见的和容易的。

    Git v2.1 Release Notes

    自 v2.0 以来的修复

    • .gitignore 中引用了尾随 SP 的模式处理不当 带有反斜杠(例如以“\”结尾的反斜杠)已 更正。 (稍后合并 97c1364be6b pb/trim-trailing-spaces 以维护)。

    Git 2.5 Release Notes

    自 v2.4 以来的修复

    • 读取 .gitignore 和 .gitattributes 文件的代码路径已 教导这些以 UTF-8 编码的文件可能有 UTF-8 BOM 标记 开始;这使其符合我们为配置所做的工作 文件已经。 (稍后将 27547e5 cn/bom-in-gitignore 合并到维护中)。

    【讨论】:

      猜你喜欢
      • 2019-08-15
      • 1970-01-01
      • 2016-01-24
      • 2019-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-27
      • 2023-03-31
      相关资源
      最近更新 更多