Is there a way in IntelliJ 14 to show the full log of a specific file?
I mean: executing a kind of git log --follow
graphically in order to see the old versions; before those files were potentially renamed.
Currently, when I do Git => Show History on a file, it only shows the equivalent of git log
.
The --follow
seems to have been judged "buggy", but git log should follow rename on IDEA:
See "IDEA-66700 git log should follow renames (--follow
option) ":
Closing: the request was fixed a while ago (not via buggy -–follow
though).
You would find additional information in "IDEA-89370 Git: show history for renamed folder omits history before rename "
We don't use --follow
(because of its buggy nature): instead we call git show -M
on the last commit and check if the file has been renamed in this commit, and in this case request history for the old file name, and so on.
Note that (not that it is necessarily the case here) trying to show the history of a renamed folder wouldn't work anyway:
Calling git log -- <dir>
even with --follow
doesn't follow renames, which is however logical since the log is filtered by new directory name, and the old name doesn't match it.
I.e. Git itself doesn't provide history for directories across renames.
For certain kind of file rename, there are still issues:
"IDEA-89347 Git: part of the file history is not shown because of cyclic renames of the file."
git log --follow
perfectly follows all these renames. But as we know, it doesn't show merges. So we can't use it.
Instead, our algorithm of retrieving the whole file history needs to be improved.
We actually need to look at each revision and check if the file was renamed there.
Of course, calling git show --name-status -M
for each revision is very expensive.
Here is the solution: call git log --name-status
and look at those revisions of the file, where it is ADDED (renames are not shown by git log
, even with "-M
", because we limit it to the supplied file path).