https://github.com/yibn2008/easy-nodegit
A high level wrapper for nodegit with simple and elegant API
https://github.com/yibn2008/easy-nodegit
easy-nodegit git git-client nodegit nodejs-wrapper
Last synced: 7 months ago
JSON representation
A high level wrapper for nodegit with simple and elegant API
- Host: GitHub
- URL: https://github.com/yibn2008/easy-nodegit
- Owner: yibn2008
- Created: 2018-05-04T06:46:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-09T03:04:51.000Z (over 7 years ago)
- Last Synced: 2025-05-25T13:05:47.855Z (8 months ago)
- Topics: easy-nodegit, git, git-client, nodegit, nodejs-wrapper
- Language: JavaScript
- Size: 17.6 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
Awesome Lists containing this project
README
# easy-nodegit
A simple and elegant git client base on nodegit.
## install
```bash
npm install easy-nodegit --save
```
## Usage
Simple git client API, just like using git command:
```js
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](./API.md)
## LICENSE
MIT