Last updated December 14, 2014.
The git blame command can be used to determine when a certain change was made. This document will explain how to use this functionality on the command line and on Drupal's git repository browser at drupalcode.org.
Using git blame on the command line
- Clone the repo you wish to run a blame on by following the revision instructions on the "Version Control" tab. For example, see: the Drupal revision instructions.
- In your terminal, run the command
git blame <options> <filename>, where the filename is the name of the file you wish to run the blame on, and options are things like, line number range. (See git blame.)
- In the results of your git blame, you should see a hash indicating which commit made the last change to each line. Running
git log <your hash> -pshould give you more details of that specific commit.
Using git blame on drupalcode.org
Unfortunately, drupalcode.org no longer supports git blame via the repo browser.
Generate statistics from 'git blame' with 'git fame'
Note: git fame requires Ruby version >= 1.9.2.
To check your current Ruby version, execute in your terminal: