ããæ¥ä»ã®commitã®IDã ãæãåºã
git-id-date.rb
#!/usr/bin/env ruby require 'date' if ARGV.size < 1 STDERR.puts "ruby #{$0} 2011-08-15" STDERR.puts "ruby #{$0} 2011-08-15 2011-09-30" exit 1 end date_start = Date.parse(ARGV.shift) date_end = ARGV.empty? ? Date.today : Date.parse(ARGV.shift) lines = `git log`.split(/[\r\n]/) id = nil date = nil lines.each do |line| if line =~ /^commit\s[a-zA-Z0-9]+$/ id = line.split(/\s/)[1] elsif line =~ /^Date:\s/ date = Date.parse line.scan(/^Date:\s+(.+)$/).first.first puts id if date_start <= date and date <= date_end id = nil date = nil end end
gitãªãã¸ããªå ã§ã
ruby git-id-date.rb 20110815 20110830
ã¨ãããã¨8/15ã8/30ã®éã®commit idãã§ã¦ããã
ããæéã®commit logãå ¨ã¦ãã¡ã¤ã«ã«æ¸ãåºã
mkdir -p ~/tmp/gitdiff git-id-date.rb 20110815 20110830 | ruby -lane 'puts cmd="git show #{$_} | > ~/tmp/gitdiff/#{$_}";system cmd'