Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Using Eclipse, how to delete a file which has been in GitHub but should been in .gitignore file?

If a file "a.txt" has been committed and pushed to a GitHub repo but I want to ignore it now.

Using git bash, I could use git rm --cached a.txt and a new line "a.txt" in .gitignore to delete this file in the GitHub repo.

But what should I do if I use Eclipse ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Eclipse allows you to mark files as Untracked by right-clicking on the file and selecting Team>Advanced>Untrack even if that file is present in the .gitignore.:

enter image description here
(I removed some unnecessary parts of the context menu)

This will essentially do the same as git rm --cached.

Then, the file will be marked as deleted in the Staged Changes part of the Git Staging menu:

enter image description here

After doing that, just commit and push the (staged) changes.

Of course, nothing stops you from using the command-line. Even if you use Eclipse, you can still enter some commands via the command-line and do some other stuff with Eclipse/EGit.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading