Created
March 22, 2013 14:14
-
-
Save nfelger/5221574 to your computer and use it in GitHub Desktop.
get commit messages
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
require 'grit' | |
root_dir = "/some/path" | |
terms = ['niko', 'nfelger'] | |
Dir[root_dir + "/*/.git"].each do |dir| | |
repo = Grit::Repo.new(dir) | |
File.open("/where/ever/commit_messages/#{dir.split('/')[-2]}", 'w') do |file| | |
step = 100 | |
offset = -step | |
while (commits = repo.commits('master', step, offset += step)).any? | |
commits.each do |commit| | |
if terms.any?{|term| commit.author_string =~ /#{term}/i} | |
file.puts commit.message | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment