First, the reason for the configuration. Gitignore
The expression ". Gitignore" is not tracked by git, and there are a number of factors in the actual development process that prevent some files from being added to version control, such as:
Different computers, the development of different versions of the software, as well as some of the software configuration, and compile generated files and so on ~ ~ and in the development process will encounter a lot of conflicts, so you need to do a good configuration of ". Gitignore" file.
Ii.. Gitignore syntax
The syntax for the ". Gitignore" File is explained first: (For details, please check the official documentation)
1. Use # to comment the statement, after # The content will be ignored by git
2. You can use blank lines to increase readability and aesthetics
3. The characters ending with a slash (/) are treated as folders, and all files under the folder are ignored
As build/means git ignores all files in the build/directory (although it does not seem to add the same, but it must be guaranteed to be a directory, not a file)
4. Local and global files with the same name ignore the problem
As/todo means git simply ignores the TODO file under the project root, not including Subdir/todo
As doc/*.txt means git ignores doc/notes.txt but does not include Doc/server/arch.txt
If doc/**/*.txt means git ignores all files in the TXT format of the doc directory
5. ". Gitignore" matches using the Glob syntax (simplified regular expression): "
An asterisk (*) matches 0 or more arbitrary characters
[ABC] matches any one of the characters in square brackets (either match a, match a B, or match a C)--such as *. [OA] indicates that git ignores all files ending with. O or. A
The question mark (?) matches only one arbitrary character;
If you use a dash to separate two characters in square brackets, all of the two character ranges can be matched (for example [0-9] to match all 0 to 9 digits; [0-9a-za-z] means matching all numbers 0 to 9 and all letters)
Precede a file with an exclamation point (!) to reverse, indicating that the file is excluded. Such as
# Ignore all files ending with. A
*.a
# but except LIB.A
!lib.a
】
6. The name of the file under the root directory can be added/, or not added
Iii. My. Gitignore file (Android Studio)
I usually add/.idea/encodings.xml files.
# Gradle Directory.gradle/Build/# files forThe Dex VM*. dex#built Application Files*. apk*. ap_# Java class Files*. class# Local Configurationfile(SDK path, etc) Local.properties.idea/Workspace.xml.idea/Libraries.idea/Gradle.xml.idea/Misc.xml.idea/encodings.xml# OSX files. Ds_storecaptures/# generated files (should not be needed in studio) bin/Gen/# Windows thumbnail dbthumbs.db
Explain:
The local.properties file points to the absolute path in the file system above the SDK, so definitely should not be versioned.
Add. gradle Ignore Gradle wrapper things that should not be included in version controlled
Add to. Ds_store This folder is specific to Mac systems and should not be versioned
In Idea 13 and earlier versions,Datasources.ids, Datasources.xml can contain database passwords, so to add it to version control, Idea 14 solves this problem, So there's no need to add any more.
A lot of people say to ignore. IML but IntelliJ docs indicates that IML must be included in version control, so I don't add. iML.
Iv.. gitignore files circulating on the Internet for Android.
Share the project. IPR file and all the. IML module files, don ' t Share the. iws file as it stores user specific settings
# built application files*. apk*. ap_# Files forThe Dex VM*. dex# Java class Files*. class# built native files (remove the item if a third-party library is used)*. O*. so# generated Filesbin/Gen/# Ignore Gradle files.gradle/Build/# Local Configurationfile(SDK path, etc) local.properties# Proguard folder generated by Eclipseproguard/# Eclipse Metadata.metadata/# Mac OS X clutter*. ds_store# Windows clutterthumbs.db# Android Studio Navigation Editor Temp files.navigation/# Android Studio captures Foldercaptures/# Intellij Idea (see https://intellij-support.jetbrains.com/entries/23393067). idea/Workspace.xml.idea/tasks.xml#in Idea -And in earlier versions, Datasources.ids, Datasources.xml can contain database passwords. Idea -solved the problem. So you can not add. idea/Datasources.xml.idea/datasources.ids
There seems to be a special plugin on the Internet--
Configuration of the. gitignore file in Android development