GitKit.js
Pure JavaScript implementation of Git backed by immutable models and promises.
The goal is to provide both a low and high level API for manipulating Git repositories: read files, commit changes, edit working index, clone, push, fetch, etc.
This library can work both in the browser and Node.js.
Installation
$ npm install gitkit
Usage
API
var GitKit = ;var NodeFS = ; // Prepare the filesystemvar fs = ; // Create a repository instancevar repo = GitKitRepository;
Clone a remote repository
// Create a transport instance for the GitHub repositoryvar transport = 'https://github.com/GitbookIO/gitbook.git'; GitKitTransferUtils
List branches
GitKit.BranchUtils.list
returns a promise listing branches as a list of strings.
GitKitBranchUtils
Get current branch
GitKit.BranchUtils.getCurrent
returns a promise resolved with the name of the current active branch.
GitKitBranchUtils
List files in repository
GitKit.WorkingIndex
provides a set of methods to work with the working index.
GitKitWorkingIndex ;
List changes not staged for commit
GitKit.ChangesUtils
provides a set of methods to work with pending changes.
GitKitChangesUtils ;
More example and documentation coming soon!
I'll publish a better documentation for this library soon.
Thanks
To the people pointing me in the right directions like:
License
GitKit.js
is Apache-licensed.