-
-
Save robwalch/3238737 to your computer and use it in GitHub Desktop.
git blame with grep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/ruby | |
grep = `git grep -n #{ARGV[0]} #{ARGV[1]}` | |
files = grep.scan /.*\:\d+/ | |
interrupt = false | |
files.each do |file_with_line| | |
exit if interrupt | |
file, line = file_with_line.split(':') | |
system "git blame -fL #{line},#{line} #{file}" | |
trap('INT'){interrupt = true} | |
sleep 0.01 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment