How to find out who changed some lines of a file?

git blame -L from_line,to_line file_name

To find out who changed some lines of a tracked file use git blame -L from_line,to_line file_name. Git blame will show the lines of a file between from_line and to_line, together with the commit SHA the line was changed in, the author and the date of the change.

Layer 1
Terminal Example
git blame -L 3,5 plugins.sbt
fc7c04df8 (An Chovy   2020-06-26 13:18:19 +0200 3) addSbtPlugin("org.scalaxb"       % "sbt-scalaxb"         % "1.7.3")
bf8a96c16 (Tom Ato    2020-12-30 14:42:39 +0100 4) addSbtPlugin("com.typesafe.sbt"  % "sbt-native-packager" % "1.7.6")
bf8a96c16 (Tom Ato    2020-12-30 14:42:39 +0100 5) addSbtPlugin("org.scalameta"     % "sbt-scalafmt"        % "2.4.2")

See git blame to learn more about it.

Last modified on November 30, 2021.

You might also like