`git log` command is used to view the commit history and display the necessary information of the git repository. This command displays the latest git commits information in chronological order, and the last commit will be displayed first.
The git log command displays all of the commits in a repository's history. By default, the command displays each commit's: Secure Hash Algorithm (SHA) author. date.
Please have a try with git log --follow
on your file. I learn from here Is it possible to move/rename files in git and maintain their history?
Well, I do see my renames with git log -M --summary
..
Answering my own question, since I have managed to assuage my concerns, even if I haven't solved my problem exactly. (git log --follow
still doesn't work for me, though.)
Firstly, the --summary
log for the renaming commit includes the delete
line with the file's old name. So if it's easy to spot, you can find its old name and git log
from there.
If it's part of some large commit, and therefore a bit harder to spot -- and this situation was one of my worries -- git blame -C
can be used with the file's new name on the first post-rename revision. Presumably lines remain from the original file! -- so git should find their source, and show old file name (and a commit hash for good measure). You can then pick up the trail with git log
.
So, if you have some interest in the history of the file as a unit (for whatever reason) then it seems like it can be done relatively straightforwardly. Though I get the impression git would prefer that you used it properly.
git log --follow ./path/to/file
I believe this is what you're looking for.
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