nodejs操作git
Execute git command using Node.js
npm i git-commands --save
const Git = require('git-commands')
const git = new Git({ reps: 'your git repository path' })
// status
console.log( git.command('status') )
// pull
console.log( git.command('pull') )
// checkout
console.log( git.command('checkout master') )
// push
console.log( git.command('push origin master') )