Git blame for all revesions of a file

349 Views Asked by At

I'm working with Git repository, and I need to get "blame" data for a file (ex. log-tree.c). So, I'm using the following command

git --git-dir=/home/gh/git/.git --work-tree=/home/gh/git blame log-tree.c 

However, it just shows the data for the last revesion of the file, but I need to get the "blame" information of each revesion of that file. So, how can I do that ?

1

There are 1 best solutions below

2
On

You can specify the revision for which you want the "blame" output by specifying a <rev> on the command line. For example:

git blame HEAD^ log-tree.c

will show the blame output for the previous revision. You can use this feature to get the blame output for any historical version of your file.