android studio使用.gitignore建立项目过滤规则

# OSX
*.DS_Store

# Gradle files
build/
.gradle/
*/build/

# IDEA
*.iml
.idea/
.idea/.name
.idea/encodings.xml
.idea/inspectionProfiles/Project_Default.xml
.idea/inspectionProfiles/profiles_settings.xml
.idea/misc.xml
.idea/modules.xml
.idea/scopes/scope_settings.xml
.idea/vcs.xml
.idea/workspace.xml
.idea/libraries


# Built application files
*.apk
*.ap_


# Files for the Dalvik VM
*.dex


# Java class files
*.class


# Generated files
antLauncher/bin
antLauncher/gen


# Local configuration file (sdk path, etc)
local.properties


# Log Files
*.log


.settings

.classpath

bin

coverage

coverage.ec

coverage.em

gen

javadoc

junit-report.xml

lint-results.*ml

lint-results_files

local.properties

monkey.txt

*~

*.iws

atlassian-ide-plugin.xml

target

out

build.xml

proguard-project.txt


创建完上面的过滤文件后   需要执行以下方法才能生效:

改动过.gitignore文件之后,在repo的根目录下运行:
git rm -r --cached .
git add .
之后可以进行提交:
git commit -m "fixed untracked files"

如果执行上面方法不能生效,并且在创建上面文件之前已经提交代码到版本库了,那么这个时候可以尝试以下方法将想要过滤的相关文件,那么只能关掉开发工具,然后删除相关想要被过滤的文件。然后

git add -A

git commit -m "fixed untracked files"
git push origin master
git pull

此时打开开发工具即可实现想要的过滤效果了。



参考:

http://my.oschina.net/u/244918/blog/389341?p={{page}}

http://blog.csdn.net/linghu_java/article/details/45667431


你可能感兴趣的:(android)