4

I'm really not even sure how to start with this, but it seems like the sort of thing that should be available.

In a project we have a particular line of code:

if(!current_user_can('administrator'))

I'm trying to figure out how added that line and what issue/commit it belonged to, but I can't seem to figure out a way to do that?

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Drew Angell
  • 25,968
  • 5
  • 32
  • 51
  • 3
    Possible duplicate of [Retrieve the commit log for a specific line in a file?](http://stackoverflow.com/questions/8435343/retrieve-the-commit-log-for-a-specific-line-in-a-file) – Wouter J Jan 22 '16 at 23:52

1 Answers1

6

You can use git blame <file> and navigate to the relevant line of code. Alongside the line itself it will display the commit hash that introduced it and the author of that patch.

Mureinik
  • 297,002
  • 52
  • 306
  • 350