git - 为什么 .gitignore 不适用于 Android Studio 中的新项目?

标签 git android-studio gitignore

我使用 .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 init screenshot
git status命令
git status screenshot
git add .git status命令
git add screenshot
git commit命令
git commit screenshot
git status具有空值的命令
git status screenshot

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/

相关文章:

git - 为什么提交不遵循 merge 基础错误?

ruby-on-rails - 跨多个 ruby​​/rails 项目共享自定义 RSpec 匹配器的最干净、最简单的方法是什么?

android - 如何从 android 中的 SQL Server 检索 varbinary(max) 图像?

java - 如何在按下按钮之前激活按钮?

android - 如何摆脱 "Choose external documentation root"对话框?

git - 如果在 repo 中发生更改,是否可以停止跟踪您*确实*想要 pull 下的文件的本地更改?

git - 忽略早期提交中的目录

git - 使用 JGit 使现有的 Git 分支跟踪远程分支?

git - 如何访问 Github for windows 上的一些命令

reactjs - 如何在 HTML <script src =""中引用 process.env 变量? react