Created
November 7, 2012 14:14
-
-
Save sjmulder/4031842 to your computer and use it in GitHub Desktop.
Quickly search through a reflog
This file contains hidden or 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/bin/ruby | |
# Some bash-fu should be able to do the same but I'm only a white belt | |
if ARGV.length < 1 | |
$stderr.puts 'usage: lostfind <keyword> [<keyword> ...]' | |
else | |
reflog = `git reflog` | |
reflog.each_line do |line| | |
hash, _, message = line.split(' ', 3) | |
data = `git show #{hash}` | |
if ARGV.any? { |arg| data.include?(arg) } | |
puts line | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment