remove a file from GIT control

Leem.fin picture Leem.fin · Feb 15, 2012 · Viewed 53.6k times · Source

Possible Duplicate:
git - removing a file from source control (but not from the source)

I have a .classpath file which is currently in GIT repository.

After I pulled from remove repository(git pull origin master). How can I remove this file from GIT control, I mean NOT to delete this file from my computer but remove it from GIT version control. (Because this file is not needed for version control).

P.S.

I tried git rm <path-to>/.classpath , but then my whole project complains about wrong class path, why git rm delete my file instead of remove from version control ???

Answer

Platinum Azure picture Platinum Azure · Feb 15, 2012

Use git rm --cached to remove from the index but not the working tree.

After that, you should add .classpath to your .gitignore file, to prevent it from being committed again.