Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view complete commits when tracking history of a single file in Git?

Tags:

git

gitk

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?

like image 939
Milan Babuškov Avatar asked Dec 29 '09 12:12

Milan Babuškov


People also ask

How view git commit history from a file?

Git file History provides information about the commit history associated with a file. To use it: Go to your project's Repository > Files. In the upper right corner, select History.

How can you view all the commits for a single file in eclipse?

Select a file or directory in the Editing page, and choose Git Log in the Actions menu. This will show all commits in your current local branch that involve changes to the chosen file or directory.

Which command is used to view the history of all the changes to a file?

Use --follow option in git log to view a file's history This lists out the commits of both the files.


1 Answers

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.

like image 59
iamamac Avatar answered Oct 19 '22 20:10

iamamac