Git不会停止跟踪eclipse java .recommenders

时间:2014-12-25 21:40:53

标签: java eclipse git eclipse-luna

我没有在Eclipse Luna之前遇到过这个问题(我几天前从开普勒更新过)。 虽然我将.recommenders添加到.gitignore,但它会一直跟踪它。

$ git status
On branch master
Your branch is up-to-date with 'origin/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:   .recommenders/caches/identified-project-coordinates.json
        deleted:    .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_3.fdt
        deleted:    .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_3.fdx
        deleted:    .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_3.fnm
        deleted:    .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_3.frq
        deleted:    .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_3.nrm
        deleted:    .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_3.prx
        deleted:    .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_3.tii
        deleted:    .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_3.tis
        modified:   .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/segments.gen
        deleted:    .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/segments_4
        modified:   .recommenders/repository/http___download_eclipse_org_recommenders_models_luna_/org/ecli
.properties

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_5.fdt
        .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_5.fdx
        .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_5.fnm
        .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_5.frq
        .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_5.nrm
        .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_5.prx
        .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_5.tii
        .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/_5.tis
        .recommenders/index/http___download_eclipse_org_recommenders_models_luna_/segments_6

no changes added to commit (use "git add" and/or "git commit -a")

这是我的.gitignore文件:

*target*
*.jar
*.war
*.ear
*.class

# eclipse specific git ignore
*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
.recommenders/

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

如果我执行git rm -rf --cached它会将其删除,但很快就会再次开始跟踪 - 只要我的同事对他的文件进行更改并将其推送到Bitbucket上,我就会拉。 我应该如何永久解决此问题?

另外,当我刚刚做了&#34; git rm -r --cached .recommenders&#34;它删除了一大堆缓存文件,但顶级目录保留。

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        .recommenders/

nothing added to commit but untracked files present (use "git add" to track)

如果我尝试删除它,那么它会完全重置Eclipse工作区,我必须重新导入所有项目(所以它没有物理删除工作区&#34;。

1 个答案:

答案 0 :(得分:5)

事实证明,在一个工作站上缺少了

.recommenders/

在一个工作站上的.gitignore文件中。 添加它以及运行

git rm -rf --cached
每个工作站上的

解决了这个问题。