Module Git
In: lib/git/author.rb
lib/git/base.rb
lib/git/branch.rb
lib/git/branches.rb
lib/git/diff.rb
lib/git/index.rb
lib/git/lib.rb
lib/git/log.rb
lib/git/object.rb
lib/git/path.rb
lib/git/remote.rb
lib/git/repository.rb
lib/git/status.rb
lib/git/working_directory.rb
lib/git.rb

Git/Ruby Library

This provides bindings for working with git in complex interactions, including branching and merging, object inspection and manipulation, history, patch generation and more. You should be able to do most fundamental git operations with this library.

This module provides the basic functions to open a git reference to work with. You can open a working directory, open a bare repository, initialize a new repo or clone an existing remote repository.

Author:Scott Chacon (schacon@gmail.com)
License:MIT License

Methods

bare   clone   init   open  

Classes and Modules

Class Git::Author
Class Git::Base
Class Git::Branch
Class Git::Branches
Class Git::Diff
Class Git::GitExecuteError
Class Git::GitTagNameDoesNotExist
Class Git::Index
Class Git::Lib
Class Git::Log
Class Git::Object
Class Git::Path
Class Git::Remote
Class Git::Repository
Class Git::Status
Class Git::WorkingDirectory

Constants

VERSION = '1.0.3'

Public Class methods

open a bare repository

this takes the path to a bare git repo it expects not to be able to use a working directory so you can’t checkout stuff, commit things, etc. but you can do most read operations

[Source]

# File lib/git.rb, line 51
  def self.bare(git_dir)
    Base.bare(git_dir)
  end

clones a remote repository

options

  :bare => true (does a bare clone)
  :repository => '/path/to/alt_git_dir'
  :index => '/path/to/alt_index_file'

example

 Git.clone('git://repo.or.cz/rubygit.git', 'clone.git', :bare => true)

[Source]

# File lib/git.rb, line 88
  def self.clone(repository, name, options = {})
    Base.clone(repository, name, options)
  end

initialize a new git repository, defaults to the current working directory

options

  :repository => '/path/to/alt_git_dir'
  :index => '/path/to/alt_index_file'

[Source]

# File lib/git.rb, line 74
  def self.init(working_dir = '.', options = {})
    Base.init(working_dir, options)
  end

open an existing git working directory

this will most likely be the most common way to create a git reference, referring to a working directory. if not provided in the options, the library will assume your git_dir and index are in the default place (.git/, .git/index)

options

  :repository => '/path/to/alt_git_dir'
  :index => '/path/to/alt_index_file'

[Source]

# File lib/git.rb, line 65
  def self.open(working_dir, options = {})
    Base.open(working_dir, options)
  end

[Validate]