Configuring Eclipse to Show Git Revision Information Similar to Git Blame in Editor

Eclipse can work well with Git. We discussed Configuring Eclipse to Highlight Changed Lines Compared to Git Commit before. Eclipse can also show the revision information for lines of code (from git blame) which is useful to understand why some lines are added in the context of previous revisions including the lines of code. Eclipse can support showing the Git revision information in its editor although by default this feature is not enabled. We will discuss how to show Git revision information in Eclipse editor.

Enable showing Git revision information in Eclipse editor

We need the EGit – Git Integration for Eclipse plugin for Eclipse to have the git blame like git revision info feature for Eclipse. Install it first from the Eclipse Marketplace.

To enable showing Git revision information in Eclipse editor, right click the editor left border (with line numbers) and select the Show Revision Information entry to enable it.

View Git revision information in Eclipse editor

After the Git Revision Information feature is enabled, when we would like to view the revision information for a line, hover the mouse over the line number on the left border of the editor for that line. The revision information will be shown in the pop up dialog.

Set Git revision information options in Eclipse editor

Eclipse also has several options for the Revision Information feature to fine tune what will show and the colors. We can choose to color the labels by dates or by authors, or show the Author or/and Id for the commits.

One comment:

Leave a Reply

Your email address will not be published. Required fields are marked *