I wondered if any of you knew of a tool that would allow me to select a line in my code and then view a list view of the history of that line on a commit-by-commit basis.
Does anyone know of such a tool?
Press Ctrl+K L , or right-click the tab title then click "Show Line History" to enter the "Line History" view. In the "Line History" view: Press [ or ] to check out previous, or next versions. Press d to toggle deleted lines.
If you want to see what's happened recently in your project, you can use git log . This command will output a list of the latest commits in chronological order, with the latest commit first.
Review file history Select Git | Show History from the main VCS menu or from the context menu of the selection. The History tab is added to the Git tool window showing the history for the selected file and allowing you to review and compare its revisions.
Maybe annotations in IntelliJ IDEA is that you are looking for:
I know only the IntelliJ IDEA "Viewing Changes History for Selection" feature.
You could also try to use several git blame
commands to iterate over history of a fragment.
If you would like to view inline
such information then you may add GitToolBox plugin. Live example on YT
Example view:
How to setup:
git-log
shows commit logs.
You can specify -L option to trace the evolution of the line range given by ",". You can specify this option more than once.
git log -L 40,50:foo.txt
If you are using IntelliJ then, its annotation feature provides an option to do the annotation on previous revision. Using this option you can go back to the history of that line.
Find below screen-shot which shows, This option and its available in the community edition as well.
As suggested in one of the comments in Can Git show history for selected lines?
git show $(git blame example.js -L 250,260 | awk '{print $1}')
more info: Every line of code is always documented.
In IntelliJ, you can use show history for selection in the git submenu after selecting a line/ multiple lines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With