Viewing Git history of moved files
GitGit Problem Overview
Despite reading lots of other posts regarding GIT and moved files I still struggle to understand how to trace the full history. Doing gitk myfile
as suggested here seems to only show history until the previous move. I understand that GIT doesn't track files, only their content. So surely I should be able to view the full evolution of a file, even if it's been moved?
Can anyone direct me to a good yet simple example/tutorial?
I'd like to see an example where some files are moved around, changed and committed, then the history of a single file is displayed, moves and all. I've been looking at 'log' but that seems to concern checkins. Would still appreciate some advice, even if its says I'm somehow still thinking too much SVN.
Git Solutions
Solution 1 - Git
Try using the --follow
option to git log
:
git log --follow file.txt
Solution 2 - Git
Use git log
with both --follow
and --patch
which will display the log with the rename from / rename to output. And don't forget the --
before the file path.
git log --follow --patch -- path/to/file.ext
For example the history of file testdir/more-testing.txt
on my system shows:
>```Author: Igal