Skip to content

Instantly share code, notes, and snippets.

@JamesHagerman
Created September 9, 2014 23:49
Show Gist options
  • Save JamesHagerman/f61456eec50f57acd03f to your computer and use it in GitHub Desktop.
Save JamesHagerman/f61456eec50f57acd03f to your computer and use it in GitHub Desktop.
This simple Ruby script will find all of the git repo's on your machine and dump all of the git history for you. Exclusions are on line 5. Your Git username is on line 13.
#!/usr/bin/env ruby
require 'shellwords'
puts "Finding all git repos on this machine..."
all_paths = `find ~/ -iname ".git" -not -path "*.rvm*" -not -path "*Circuits*" -not -path "*CLOUDS*" -not -path "*disorient*"`.split("\n")
# puts "Paths: #{all_paths}"
# Actually grab the history of each repo and dump it to the command line:
all_paths.each_with_index do |path,i|
Dir.chdir(path) do
fixed_path = Shellwords.escape(path)
puts "History of repo at: #{fixed_path}"
cmd = "git --no-pager log --pretty=format:\"%ad:%an:%d:%B\" --date=local --all --committer=\"James Hagerman\""
system(cmd)
end
puts "=============="
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment