/git

Yet another Crystal library for manipulating Git repositories in an object-oriented way.

Primary LanguageCrystalMIT LicenseMIT

Crystal Git

Yet another Crystal library for manipulating Git repositories in its object-oriented way.

Crystal Git internally wraps libgit2 and provides the similar API.

This project is currently experimental.

Build Status

Installation

Add this to your application's shard.yml:

dependencies:
  git:
    github: mosop/git

Code Samples

Checkout from Remote Branches

`git init`
`git remote add origin https://github.com/mosop/git.git`

repo = Git::Repo.open(Dir.current)
repo.remotes["origin"].checkout("master")

puts `git branch` # prints "* master"

Remote URLs

`git init`
`git remote add origin https://github.com/mosop/fetch.git`
`git remote set-url --push origin https://github.com/mosop/push.git`

remote = Git::Repo.open(Dir.current).remotes["origin"]
remote.fetch_url # => https://github.com/mosop/fetch.git
remote.push_url # => https://github.com/mosop/push.git

Usage

require "git"

and see:

Release Notes

See Releases.