Created
June 23, 2014 18:45
-
-
Save zph/e8b3d7bd4a0a756cdaf3 to your computer and use it in GitHub Desktop.
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/env ruby | |
| # | |
| # Usage: ./git-all-commits ~/source > commits.log | |
| # commits.log will contain all commits in following format: | |
| # repo_name: SHA FIRSTLINE_COMMIT_MSG | |
| require 'pathname' | |
| dir = ARGV.dup.first | |
| # INITIALS = 'zh' # replace with your own | |
| INITIALS = nil # Place initials here | |
| unless INITIALS | |
| warn "Must place INITIALS on Line 7." | |
| exit(1) | |
| end | |
| dirs = Dir.glob("#{File.expand_path(dir)}/*") | |
| output = dirs.flat_map do |d| | |
| if Dir.exists?(d) && Dir.exists?(File.join(d, ".git")) | |
| Dir.chdir(d) do | |
| log = `git log --oneline`.chomp.split("\n") | |
| log.map { |l| [d, l].join(": ")} | |
| end | |
| end | |
| end.compact | |
| output.select! { |i| i[/#{INITIALS}/i] } | |
| output.reject! { |i| i.split(" ")[2][/^Merge/]} | |
| puts output.join("\n") |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Replace
INITIALSwith your own, then run like./git-all-commits ~/source > commits.log