gittle

Simple Node.js wrapper for the Git CLI

npm install gittle
12 downloads in the last day
148 downloads in the last week
508 downloads in the last month

Gittle

A simple Node.js wrapper for the Git CLI. The API uses promises.

Installation

npm install gittle

Examples

Load a repository

var Gittle = require("gittle");
var repo = new Gittle("./");

Initialize a repository

Gittle.init("./test").then(funciton(repo) {
    // ...
});

Clone a repository

Gittle.clone("https://github.com/FriendCode/gittle.js.git", "./test").then(function(repo) {
    // ...
});

Get repository status

repo.status().then(function(status) {
    // ...
});

Push

repo.push(remote, branch, {
    // used for https push:
    'username': "...",
    'password': "..."
}).then(function(status) {
    // ...
});

Method Gittle.clone, Repo.push, Repo.pull, Repo.fetch accept as last arguemnt an object with 'username' and 'password' credentials for https authentication.

List branches

repo.branches().then(function(branches) {
    console.log(branches);
});

List commits

repo.commits(start, limit, skip).then(function(commits) {
    console.log(commits);
});

List tags

repo.tags().then(function(tags) {
    console.log(tags);
});

Create a branch

repo.create_branch("branch_name").then(function() {
    // ...
});

Delete a branch

repo.delete_branch("branch_name").then(function() {
    // ...
});
npm loves you