git.js
Simple api to run git commands from nodejs
API
Note: most of git.js functions return javascript promises.
First you need to call require('git')
to start using git.js API as in example below:
var dir = __dirname; // dir with .git repositoryvar git = dir;
Next you could call any of the following functions.
log command
Use log command to fetch array of commits. Example:
git;
status command
Use status command to fetch array of changed files to be committed to git database. Example:
gitstatus;
diff command
Use diff command to fetch diffs for given files. Example:
var files = ; // list of file pathes to get diffs for, all changed files when this list is empty or omittedgit;
other functions
All undocumented functions could be found in the source code.
TODO
- cover more commands
- unit tests