Take the 2-minute tour ×

I'm using eclipse with Egit. I'm trying to undo the changes of a single file which has not yet been committed. From what I read, it should be as simple as opening up the Git Staging view, right clicking on the file and selecting "Replace with File in Git Index". However, this options always appears disabled (enabled are only the other two, "Open working tree version" and "Add to git index").

My questions are:

  • Why does it appear disabled?
  • Is there another, simple way to undo the changes in a specific file, which has not yet been committed?

I'm using Eclipse 3.7.2 (the one bundled with PDT), Egit on Ubuntu 12.04.

Edit: It appears that this option is disabled when I have the same project open in PHP perspective. If I close the project from PHP perspective, then the greyed-out options are available (Replace with file in Git index and Replace with file in HEAD revision)

share|improve this question
If the Git Staging view doesn't work, can you try it in the Package Explorer view (wiki.eclipse.org/EGit/User_Guide#Replace_with_File_in_Git_Index) –  VonC Feb 19 '13 at 9:36
that only gives me "replace with local history" and "previous from local history". The file was changed outside eclipse so this is not really an option (and even if it was, I would prefer it replaced with its original counterpart from git) –  periklis Feb 19 '13 at 9:48
Are you sure this file is actually part of Git history? It is the same case (upper or lowercase) than the one in git? What a git status returns in a command line session? –  VonC Feb 19 '13 at 9:50
yes it is. In the git status it appears as "modified". The same happens for any file I change, it's not about a specific one. I can normally commit and push them, or reset the whole repository, I just can't revert one single file –  periklis Feb 19 '13 at 9:53
Ok. which Eclipse version, Egit version, Os version are you using? –  VonC Feb 19 '13 at 9:57
show 5 more comments

1 Answer

up vote 1 down vote accepted

Reinstalling PDT/Egit seems to fix the problem

share|improve this answer
Sounds good to know after all my comments ;) +1. Did you re-install a different and more recent version of PDT/Egit? –  VonC Jun 10 '13 at 16:28
Yes, I installed the most recent available, although there wasn't any changelog entry related. Who knows what was going on... –  periklis Jun 10 '13 at 17:58
add comment

Your Answer


