Puneet Singh
Puneet Singh

Reputation: 312

How do I delete ".project" file from Git?

By mistake I have committed .project file in git from Eclipse. As this file name starts with a dot it is not visible in git files in Eclipse. How do I delete it from git using Eclipse?

Upvotes: 3

Views: 3846

Answers (4)

Ajinkya Dhote
Ajinkya Dhote

Reputation: 1478

Instead off deleting .project file (as it is used by IDE) you should probably ignore .project file by adding it to exclude file

Location of exclude file

.git/info/exclude 

Upvotes: 2

Andreea Craciun
Andreea Craciun

Reputation: 310

You can use the git rm directly.

More here: https://git-scm.com/docs/git-rm

Upvotes: 0

howlger
howlger

Reputation: 34135

  1. In the Navigator view right-click the file .project and choose Team > Advanced > Untrack
  2. Right-click the file .project again and choose Team > Ignore
  3. Commit and push the changes

Upvotes: 3

Dhiraj Gandhi
Dhiraj Gandhi

Reputation: 151

If you already have a file checked in, and you want to ignore it, Git will not ignore the file if you add a rule later. In those cases, you must untrack the file first, by running the following command in your terminal:

git rm --cached FILENAME

There is a file named as .gitignore in your project directory. If not, you can create a new file in your project directory and name the file as '.gitignore'. Write in file -> '.project' and save. Now try pushing your code up. I hope it works. This file is essentially to ignore all the files mentioned while sync on GIT.

Upvotes: 7

Related Questions