GIT - 忽略eclipse资源

时间:2016-07-24 18:04:03

标签: eclipse git ignore

git status继续显示eclipse资源:

naaka@naaka-ux501:~/dev/workspaces/ebeans$ git status

On branch master
Your branch is up-to-date with 'watour/master'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working    directory)

modified:   .gitignore
modified:   .gitignore~
modified:   .metadata/.log
deleted:    .metadata/.plugins/org.eclipse.core.resources/.projects/services/org.eclipse.jdt.core/state.dat
modified:       modified:   .metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps
modified:   .metadata/.plugins/org.eclipse.m2e.core/nexus/05b0fe8524860bd73cbb07ef30fb34cc/segments.gen
modified:   .metadata/.plugins/org.eclipse.m2e.core/nexus/830bc118332e77292949ed1e6d2fabe0/segments.gen
modified:   .metadata/.plugins/org.eclipse.m2e.core/nexus/fded8792ea35992e87221e67a8dea03d/segments.gen
modified:   .metadata/version.ini

我尝试了几个版本的gitignore:

/target/
/log/
**/.project
**/.classpath
**/.metadata
**/.settings
**/.recommenders
/.project
/.classpath
/.metadata
/.settings
/.recommenders
/.gitignore~
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

我还尝试删除缓存数据并提交

git rm --cached .metadata

但他们不断回来!

2 个答案:

答案 0 :(得分:0)

您还必须清除.gitignore文件的缓存。试试吧 git rm --cached .gitignore

答案 1 :(得分:0)

您已将using文件夹添加到版本控制中,这就是它说明修改后的原因

.metadata

您需要将其从版本控制(git)中删除,然后将其添加到modified: .metadata/.log

.gitignore

然后将.metadata添加到rm -rf .metadata git add . git commit -m "Remove .metadata from version control"

.gitignore