1

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 ?

Ghadeer
  • 608
  • 2
  • 7
  • 21
  • How do you expect that information to be displayed? For a file with N lines and M revisions you'd get NxM lines of output, do you want them side-by-side? sequentially? What are you trying to see? Are you sure you don't actually want `git log log-tree.c` ? – Jonathan Wakely Dec 05 '12 at 14:53

1 Answers1

1

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.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • But, I need to have the "blame" data of all revisions not just a specific one (considering that I don't know in which revision this file was created or updated) – Ghadeer Oct 29 '12 at 19:30
  • 1
    But you don't *have* to know which revisions created or updated the file, that's what the blame function does. The `blame` command takes a file as it existed at a certain point in time, and looks back in the history to determine which revision added each specific line of that file. It does not make sense to ask for the blame output for all revisions at once. – Greg Hewgill Oct 29 '12 at 20:14