Skip to content

Instantly share code, notes, and snippets.

@chrisa
Created January 13, 2009 19:28
Show Gist options
  • Save chrisa/46579 to your computer and use it in GitHub Desktop.
Save chrisa/46579 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'grit'
commits = ARGV
r = Grit::Repo.new('.')
commits.each do |commit|
c = r.commits(commit).first
puts "#> #{c.message}"
end
commits.each do |commit|
d = Grit::Commit.diff(r, commit).first
puts "#V #{d.a_commit},#{d.b_commit}"
prefix = 'M'
prefix = 'A' if d.new_file
prefix = 'R' if d.deleted_file
puts "##{prefix} a/#{d.a_path}"
d.diff.split("\n").each do |line|
puts "#U #{line}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment