Compare Current and Previous Versions of Same File (Local History) in Eclipse


Eclipse is an IDE that is most popular among software engineers for doing their day-to-day coding, a developer spends most of the time writing code, and it's a natural practice to save the changes of a file whenever you hit a milestone, but many times, you feel like you did something wrong and want to go back to the previous versions.

Undo and Redo actions work, but what if you realized that you need to revert code changes that were made two days back? Well here is where Eclipse History comes in quite handy.

Most of the recent changes are saved as version history by Eclipse which you can revert back or compare at any point in time.


Compare File with its Previous Saved History

  • Be on the file window which you want to compare the previous versions
  • Now right-click on the file and select: Compare With -> Local History...
    Eclipse Compare Local History of a File
  • Now you should see History View of the File with Revision Times.
    Local Revison Time of the File View in Eclipse
  • Select the revision date and time which you want to compare with the current version of the file.
  • This will open up a window that compares the two versions Local vs Local History where you can see differences in the same file over time.
Local file vs Local History File Diff Window

As you may see in the above screenshot, we have compared the local history of HelloWorld.java file with its local history that you can see on the right side with the file save time stamp.

Useful Tip: Always commit your code to a repository like Git/SVN to make sure you do not lose your file version history.

-


Have Questions? Post them here!

Top Hashtags:

Advertisements

Advertisements




Advertisements