I\'ve renamed a couple of files using git mv
, used git stash
, had a quick look at HEAD (without changing it) then did git stash pop
to
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?
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.
Well, I do see my renames with git log -M --summary
..
git log --follow ./path/to/file
I believe this is what you're looking for.