18

Using the Egit plugin, is it possible to permanently remove a file from source control without deleting the local copy?

I.e., is there a GUI action equivalent to running "git rm --cached"?

(Edited to simplify question)

naomi
  • 1,855
  • 1
  • 13
  • 28
  • 1
    Untrack I thought means untrack changes. Why wouldn't you just delete the file, and then commit to remove it from your upstream repo? – Paul Webster Nov 23 '11 at 14:24
  • I don't want to delete the files locally, I want to stop them being overwritten by a pull. Deleting and recreating is not an option since some of the files and folders are ones that the Force.com IDE will not let you delete. – naomi Nov 23 '11 at 14:59
  • 1
    Although it won't **remove** the file from the repository, the "Assume unchanged" setting (Team > Advanced) should help in this regard. Be aware of the gotchas of this setting (See http://schacon.github.com/git/git-update-index.html). – Sri Sankaran Nov 23 '11 at 19:41
  • After doing this, if someone fetches this same commit, will it delete their local file? – golimar Feb 06 '17 at 09:29

5 Answers5

15

I have found the answer. Team->Untrack is indeed the equivalent of "rm --cached". However there is a known bug which produces weird behaviour when you untrack and then try to commit.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=363405

naomi
  • 1,855
  • 1
  • 13
  • 28
  • I couldn't. I stopped using EGit because of this and a bunch of other bugs. However that was over a year ago, so the Egit developers may have improved it by now. – naomi Jan 28 '13 at 10:02
  • 2
    @naomi Nope. In April it seems they just decided it was too hard and won't attempt to fix it. – EdGruberman Aug 05 '13 at 09:40
  • 1
    This is my most upvoted question AND my most upvoted answer. Shame the answer is "it's just broke"! – naomi Jan 05 '16 at 12:52
  • The standard commit dialog also didn't work for me, but I could commit the change in the Git Staging view – golimar Jan 19 '17 at 08:52
5
Team -> Advanced -> Untrack

did the job (git rm --cached) for me.

Hermann Schwarz
  • 668
  • 9
  • 17
  • For those interested in this solution...After the above step , just commit and push to your remote and it should work like a charm..good reply, thanks a lot! – labheshr Oct 21 '15 at 23:22
4

I had the same problem, after not initially including directories and files in .ignore. I also tried "Untrack" and "Remove from index" possibility, non of which helped(due to the still unresolved Egit issue). So, in the end I deleted files locally (leaving the project all in bugs), committed and pushed it to the github, and then undid the delete locally and added files to .ignore. Very unelegant, but it worked. I lost a lot of time and nerves on it, and I hope this helps someone.

dinafication
  • 305
  • 2
  • 10
0

If you need to delete invisible folder(or file) from eclipse project:

  1. Add folder(or file) to .gitignore file;
  2. Replace folder to another directory
  3. Team add to index, commit and push
  4. Replace folder(or file) to the project folder
Orgatres
  • 107
  • 1
  • 10
0

Another option, similar to what Sri Sankaran suggests in the comments, is to update the index in order to assume no modification to your config file:

On the preferences, in Egit, you can list "assumed unchanged" files :

assume unchanged

The file remains versioned and on the disk, but no modification will be detected on it.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283