Skip to content
A pure ruby implementation of Git - unmaintained. See grit for an active project that has inherited much of this code.
Latest commit 24e2b40 Nov 2, 2008 @schacon reverted testing
Failed to load latest commit information.
lib added bunches of options to the log() function (since, until, path_li… Apr 5, 2008
README.markdown updated the README due to non-maintenance of the project. Aug 26, 2008
TODO added gitr to the gem package as a binary, beginning of http-fetch im… Mar 31, 2008


* Git-Ruby Is Not Maintained *

The Git-Ruby project is no longer maintained by me. I will leave it up here for now, but almost all of this code has since been incorporated into the Grit project ( and works much, much better. If you're interested in using Git from Ruby, please check out Grit (specifically the schacon/grit fork) - it does as much as it can from Ruby and falls back to system calls if it needs to. The API is different, but the project is being actively maintained.

Git Library for Ruby

A pure ruby implementation of Git


Git public hosting of the project source code and project wiki is at:


I have included a command line pure-ruby git client called 'gitr'

The following commands are available - they all will run in pure ruby, without forking out the the git binary. In fact, they can be run on a machine without git compiled on it.

Commands currently implemented:

  • add
  • commit
  • log
  • log-shas
  • cat-file (treeish)
  • rev-parse (treeish)
  • branches
  • ls-tree (tree)


Here are some of examples of how to use the Git-Ruby package.

First you have to remember to require rubygems if it's not. Then include the 'git-ruby' gem.

require 'rubygems'
require 'git-ruby'

g ='my_project')  # has a .git subdir

g.commit('commit message')

g.log.each do |commit|
  puts commit.sha
  puts commit.message

  commit.gtree.children.each do |name, obj|
    if obj.tree?
      puts ['tree: ' name, obj.sha].join("\t")

    if obj.blob?
      puts ['blob: ' name, obj.sha].join("\t")
Something went wrong with that request. Please try again.