HACKER Q&A
📣 danielovichdk

Visualize every Git changes to a file at once?


Given the discussion around commit messages I would like to know if there is any tool that can visualize every change to a file in one go?

I want to vertically visualize the history of a given file over time and not simply by to different commits.

Something like this:

[Commit1] File.txt: hello world

[Commit2] File.txt: world hello

[Commit3] File.txt: hello wallo

I dont want to use git blame to shuffle around all the changes, but I want all the changes and the whole file to be visualized in one big list.

Does it make sense ?


  👤 foobarbaz33 Accepted Answer ✓
You can view both the log and the diffs combined into 1 output.

    git log -p -- filename
This can be a bit overwhelming with huge output, so I prefer to view the history log and the diffs separately.

I pipe the raw log into tig, a viewer that provides some interactivity.

    git log -- filename | tig
Within tig you can use Vim-like searching to jump around to and view diffs, etc.

    # navigate to each commits with vim-like search
    /commit 
    # press "n" to go to next commit
    n
    # press Enter to see diff, q to quit diff window
     q