kostyabakay
kostyabakay

Reputation: 1689

Why .gitignore not working for the new project in Android Studio?

I created project in Android Studio with .gitignore file.

.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/

After this I used git init command in project directory. git init screenshot

git status command git status screenshot

git add . and git status commands git add screenshot

git commit command git commit screenshot

git status command with empty value git status screenshot

Version of Git is 1.9.1. I don't understand why those files added to commit.

Upvotes: 4

Views: 1846

Answers (1)

stsdc
stsdc

Reputation: 446

Probably, this is a bug in 1.9.1 version.

You should update 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).

Upvotes: 2

Related Questions