Drupal Association members fund grants that make connections all over the world.
Last updated March 30, 2016.
The git blame command can be used to determine when a certain change was made. This document will explain how to use this functionality in the terminal and in 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 the options allow you to specify things like line number and range. See the git blame documentation for details. For example, this command will blame lines 62 through 76 of
git blame core/lib/Drupal/Core/Entity/Entity.php -L 62,76
In the results of your git blame, you should see a hash indicating which commit made the last change to each line. Running
git show <your hash> should give you more details of that specific commit. The commit message should also contain the Drupal.org issue ID, which you can read for background information on the 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'
git fame 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. If you own a module, it's a good practice to update the CREDITS.txt file at least before each stable release of the project.
Running git fame requires Ruby version >= 1.9.2. To check your current Ruby version, execute in your terminal: