Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

nodegit-kit

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodegit-kit

Promises for git commands like init, add, commit, status, diff

Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
478
54.19%
Maintainers
1
Weekly downloads
 
Created
Source

NodeGit-Kit

Build Status Dependencies Dev Dependencies

Promises for git commands such as git init, git status, git add *, git diff, git log and git commit -am"commit message".

Comments are welcome at nodegit-kit/issues

Install

npm i --save nodegit-kit

Usage

var git = require('nodegit-kit');

git.open('../repo-path/new/or/existing')
.then(function(repo){
    return repo;
})
.then(function(repo){
     // git diff
    return git.diff(repo)
    .then(function(diff){
        // console.log(diff);
        return repo;
    });
})
.then(function(repo){
    // git commit -am"commit message"
    return git.commit(repo, {
        'message': 'commit message'
    });
})
.then(function(repo){
    // git log
    return git.log(repo);
})
.then(function(log){
    // console.log(log);
})
.catch(function(error){
    console.error(error.stack);
});

git status

git.open('../repo-path/new/or/existing')
.then(function(repo){
     // git status
    return git.status(repo);
})
.then(function(status){
   // console.log(status);
});

git config

This is optional, if not configured, config tries to read your global git config.

git.config.set({
    'user': {
        'name': 'username',
        'email': 'user@localhost'
    }
});

Test

npm install

npm test

# debug nodegit-kit
DEBUG=kit* npm test

# debug all
DEBUG=* npm test

Keywords

promise

FAQs

Package last updated on 09 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts