Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

eclipse

egit

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.)

like image 208
Tuntable Avatar asked Jun 22 '15 07:06

Tuntable


People also ask

How do I see revision history in git?

Git file History provides information about the commit history associated with a file. To use it: Go to your project's Repository > Files. In the upper right corner, select History.

What is replace with previous revision in eclipse?

Right-click on the file you wish replace with an earlier commit, and select Replace With -> Commit... You will be presented with a list of commits to choose from. Select the commit you wish to replace the file with.


2 Answers

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).

like image 91
Denis Rosca Avatar answered Sep 30 '22 20:09

Denis Rosca


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.)

like image 37
Tuntable Avatar answered Sep 30 '22 22:09

Tuntable