Skip to content

A high level wrapper for nodegit with simple and elegant API

Notifications You must be signed in to change notification settings

yibn2008/easy-nodegit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

easy-nodegit

A simple and elegant git client base on nodegit.

install

npm install easy-nodegit --save

Usage

Simple git client API, just like using git command:

const GitClient = require('easy-nodegit')
const client = new GitClient('/path/to/repo/work/directory', {
  type: 'ssh',                        // support 'ssh' or 'http', default is 'ssh'
  // when type == 'ssh'
  privateKey: '/path/to/privateKey',  // default is ~/.ssh/id_rsa
  publicKey: '/path/to/publicKey'     // default is ~/.ssh/id_rsa.pub
  // when type == 'http'
  username: '...',
  password: '...'
})

async function test () {
  // clone
  await client.clone('git@github.com:yibn2008/easy-nodegit.git')

  // add
  await client.add([
    'index.js',
    'index.css'
  ])
  await client.add('lib/**/*.js')

  // reset
  await client.reset('index.*')

  // remove
  await client.remove('lib/modules/*')

  // commit
  await client.commit('commit message')

  // pull
  await client.pull()

  // push
  await client.push()
}

test().catch(err => {
  console.error(err)
})

API

see API.md

LICENSE

MIT

About

A high level wrapper for nodegit with simple and elegant API

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published