Eclipse / EGit to see previous version of a file (Git)

8.7k views Asked by At

Is it possible in EGit to see the simple history of a file?

Team > Show in history shows all commits to all files. Not useful.

I am looking for the history of a file. There is a button in the History view that says Show changes to selected resource but no way to select a resource.

There also does not appear to be any way to compare with a specific version unless that version has a tag.

The pieces seem to be there, but are they put together properly?

(No complex branching or other cleverness. I normally use the command line for this type of work but should not have to.)

3

There are 3 answers

0
Denis Rosca On

You can open a file (or select it from project explorer) and do: Right Click -> Team -> Show in history. This will open the following view:

The filter circled in red is: "Show all changes of selected resource and its children" which basically will filter only the commits that relate in any way to the resource you've selected (you can chose the different filters to get a better understanding of how they differ from each other).

0
Tuntable On

The problem was that the Team > Show in History needs to be run from the Project Explorer window. When I first found those scoping buttons I right clicked on the class file's edit window and did the Team > Show in History there. That appears to be broken and only shows all changes.

(Thank you for your replies. Knowing that it could be done and by those scope buttons let me look further. I rarely use the Project Explorer, preferring to just type the class/file name into the Navigate dialog.)

0
Nathan On

Some other answers suggest clicking on Team > Show in History. This menu item does not show up. Instead, Team > Show Local History shows up.

I have Git Staging tab open all the time. I saved a small change to the file I wanted to see the history of. This caused the file to show up in the Unstaged Changes in Git Staging. I then right-clicked on the file, clicked on Show In and then History. This showed me the history of the file according to Git.

enter image description here