Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove a file from GIT control [duplicate]

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 ???

like image 430
Leem.fin Avatar asked Feb 15 '12 16:02

Leem.fin


People also ask

How do I Untrack a file in git?

Removing Files To remove a file from Git, you have to remove it from your tracked files (more accurately, remove it from your staging area) and then commit. The git rm command does that, and also removes the file from your working directory so you don't see it as an untracked file the next time around.


1 Answers

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.

like image 167
Platinum Azure Avatar answered Sep 30 '22 08:09

Platinum Azure