Last updated June 13, 2015.
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:
It is ideal to create a CREDITS.txt file that objectively shows how much was done (affected code lines, files and commits) by who (Drupal.org username of the author). Of course only in terms of quantity, not quality, and only if the commits were consistently attributed to the authors throughout the history. Recommendation is to update the CREDITS.txt file at least before each stable release of a project.