Skip to content

Instantly share code, notes, and snippets.

@nightscape
Created July 24, 2014 17:47
Show Gist options
  • Save nightscape/a7a4bd11534349935f66 to your computer and use it in GitHub Desktop.
Save nightscape/a7a4bd11534349935f66 to your computer and use it in GitHub Desktop.
author = "joe"
repos = Dir["**/.git/"].map {|r| r.gsub('.git','') }
stats = repos.map {|r| [r, `cd #{r} && git log --author=#{author} --format=format:"%ad %s" --date=short`.split("\n")]}
commits = stats.flat_map {|r, cs| cs.map {|c| d,cm = c.match(/(\d{4}-\d{2}-\d{2}) (.*)/).to_a[1..2]; [d, File.basename(r), cm]}}
str = commits.sort_by(&:first).map {|c| c.join("\t")}.join("\n")
File.open("commits_#{author}.txt", 'w') {|f| f.puts str}
@nightscape
Copy link
Author

Run this script in a directory which contains all your Git projects (in arbitrary subfolders).
It will search for all commits from the specified author and sort them by date.
Good to refresh your memory sometimes ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment