I'开发者_Python百科m looking for an implementation of git which is accessible from nodejs - does such a beast exist?
Looks like there are now several options for using git from node:
- gift: simple Node.js wrapper for the Git CLI with an API based on Grit (npm / github)
- node-git: a node.js git implementation modeled on grit (npm / github)
- nodegit: libgit2 asynchronous native bindings (npm / github)
- node-git: a thin wrapper around the command-line git command (github)
Note sure if there's a git library for Node but you can also just execute a shell process directly, example:
var sys = require('sys')
var exec = require('child_process').exec;
function puts(error, stdout, stderr) { sys.puts(stdout) }
exec("git status", puts);
there is also node-gitteh as libgit2 bindings, but both gitteh and christkv/node-git were not of the quality and completeness I needed
I wrote treeeater a spawn git wrapper, which is callable with plain javascript objects instead of strings, can parse some output (git log → commit objects, git ls-tree → tree object hierachy) and runs async. It is in active use and supports all git commands, atleast for calling them and piping their output chunk or line wise. You can stick to git man-pages to get the documentation to each command.
精彩评论