How do I view a single file's history in GitK?

16.7k views Asked by At

I have a git repository with a large number of files in it. At some point a bug was introduced into my program. I have a good idea which file is causing the issue, I just need to track down which commit introduced the error.

How can I view the revision history for single file using GitK?

3

There are 3 answers

3
ilias On BEST ANSWER

To get the file history

gitk <filename>

To see the blame history in a gui, which may help you track the commit use

git gui blame <filename> 
1
danglingpointer On

You can just give the path of the file located at the dir. For example src/foo.c, you want to see the history of the file who changed it. In that case, you just need to give as gitk src/foo.c &

this will open a prompt and you can go through the history of the file.

Another way of viewing the history of file is git blame or if you want see which commit introduced the regression you can use git bisect

0
senooken On

You can filter on gitk by following steps.

  1. Select [View]>[Edit view].
  2. Fill file name to [Enter files and directories to include, one per line].
  3. Select [OK] or [Apply].