Ruby/Git

Ruby/Git

Ruby/Git is a Ruby library that can be used to create, read and manipulate Git repositories.

Currently it is a wrapper around the git binary, but I'm hoping the git libification project will come far enough that I can write some C bindings instead.

Install

gem install git

Examples

Simple Example

This is taken straight from one of the first examples on the Everyday Git tutorial from the Git website.

It initializes a repository in an existing directory, adds all the code into the index and commits it with a message

Index Work

In this example, we clone a public repository, then chdir into the working directory, do some work and then print out the contents of the index versions of all of the changed files.

Branching, Merging and Remotes

Here is a more complex example where we:

  • open a reference to a local repository
  • set configuration parameters
  • clone a remote repository
  • add that as a remote reference to our local repo
  • change into the remote clone, do work, add and commit that work
  • create a new branch, do work in it, add and commit that branch
  • go back to out local repo and pull from the remote master
  • merge in changes from the remote new branch

Develop

If you would like to help out with the project, you can download the source code by cloning my git tree, which is publicly hosted at GitHub.

git clone git://github.com/schacon/rubygit.git

If you would like to send me a patch, please do so at schacon@gmail.com, or ask me to pull your git repo.

About

Ruby/Git was developed by Scott Chacon, a fan of both Ruby and Git.