19

I have a Git repository with about a two years of history in it. I have single file in it, for which I wish to find all the commits, and for each commit: all the other files that were committed in it. Let's assume this file is named file.txt. I can run gitk with this file as argument:

gitk file.txt

and I do get each commit. However, browsing that tree in gitk only shows changes done to file.txt. I'd like to see what other files were changed in that commit. I can copy paste each commit SHA1 and display it, but there are over hundred of commits related to this file.

I notice that "comments" section in bottom-right part of screen is empty (only shows text "Comments"). Maybe a list of files could be shown there?

Milan Babuškov
  • 55,232
  • 47
  • 119
  • 176

3 Answers3

17

In the command line,

git log -p --full-diff file.txt

will output what you want.

If you must see it in gitk, invoke it with no arguments, find commit "touching path" file.txt, and the commit contains that file will be bold. And you can use the "up" and "down" buttons to traverse through it.

MarcH
  • 16,107
  • 1
  • 26
  • 22
iamamac
  • 8,708
  • 3
  • 30
  • 30
11

You can actually have '--full-diff' functionality in gitk, just not directly from the command line. Just do the following:

  • Start gitk the usual way, e.g.: gitk file.txt
  • Select 'View -> Edit view...' from the menu. Verify that you are editing the 'Command line' view.
  • In the edit box next to "Additional arguments to git log", type --full-diff
  • Click "Apply" or hit [F5].

That should do it. Why gitk doesn't allow you to use this from the command line is a mystery to me, for it is a very useful option.

ack
  • 6,488
  • 2
  • 22
  • 19
3

Another solution from the mailing list dated far back in 2008:

Try turning off the option "Limit diffs to listed paths" in the preferences menu (or adding "set limitdiffs 0" to your ~/.gitk).

prusswan
  • 6,473
  • 3
  • 37
  • 57
  • this is the only solution working for me.. the ~/.gitk is not working but changing in preferences works fine – nayana Jun 16 '16 at 11:32