naaka
naaka

Reputation: 379

GIT - Ignore eclipse resources

git status keeps on showing eclipse resources:

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

i tried several versions of 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

I also tried removing cached data and committing

git rm --cached .metadata

but they keep coming back!

Upvotes: 1

Views: 1176

Answers (2)

Deepak Mahakale
Deepak Mahakale

Reputation: 23671

You have already added .metadata folder to version control that's why it says modified

modified:   .metadata/.log

you need to remove it from version control (git) and then add it to .gitignore

rm -rf .metadata
git add .
git commit -m "Remove .metadata from version control"

Then add .metadata to .gitignore

# gitignore

.metadata/

Upvotes: 1

Shravan40
Shravan40

Reputation: 9908

You have to clear the cache of .gitignore file too. Try with git rm --cached .gitignore

Upvotes: 0

Related Questions