Skip to content

Instantly share code, notes, and snippets.

@bankair
Created February 20, 2015 13:17
Show Gist options
  • Select an option

  • Save bankair/6f501c27d3020c909e56 to your computer and use it in GitHub Desktop.

Select an option

Save bankair/6f501c27d3020c909e56 to your computer and use it in GitHub Desktop.
Display the commit that last modified a specific line of a file
#! /usr/bin/ruby
file, line = (ARGV.shift || raise('Missing loc. Ex: /path/to/file:line')).split(/:/)
exec "git show $(git blame #{file} -L #{line},#{line} | awk '{print $1}')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment