android Git使用gitignore创建项目过滤规则

在项目目录下建立  .gitignore  文件,里面的内容以下,能够根据本身的须要新增或者删除过来规则java

# Local per-repo rules can be added to the .git/info/exclude file in your
git

# repo. These rules are not committed with the repo so they are not sharedide

# with others. This method can be used for locally-generated files that you工具

# don’t expect other users to generate, like files created by your editor.开发工具

.settingsgradle

.classpathui

binidea

coveragespa

coverage.eccode

coverage.em

gen

javadoc

junit-report.xml

lint-results.*ml

lint-results_files

local.properties

monkey.txt

*~

*.iws

atlassian-ide-plugin.xml

target

build

.gradle

out

build.xml

proguard-project.txt

.idea/

*.iml

========================================================================

建立完上面的过滤文件后   须要执行如下方法才能生效:

改动过.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

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

相关文章
相关标签/搜索