node-git

Node.JS library to read git repositories.

Github星跟踪图

node-git

This is a thin wrapper around the command-line git command for use inside node applications. It's used primarily by the wheat blogging system to enable a running node.JS server to read files out of a git repository as if they were local files.

Example usage

var sys = require('sys'),
    Git = require('git');


// Test it!
Git("/Users/tim/code/howtonode.org");
Git.exists("articles/control-flow-part-ii.markdown", function (err, tags) {
  if (err) { throw(err); }
  sys.p(tags);
});
Git.getTags(function (err, tags) {
  if (err) { throw(err); }
  Object.keys(tags).forEach(function (tag) {
    Git.readDir("articles", tags[tag], function (err, contents) {
      if (err) { throw(err); }
      contents.files.forEach(function (file) {
        file = Path.join("articles", file);
        Git.readFile(file, tags[tag], function (err, text) {
          if (err) { throw(err); }
          sys.error("tag: " + tag + " sha1: " + tags[tag] + " file: " + file + " length: " + text.length);
        });
      });
    });
  });
});

More example:

var sys = require('sys');
// Git("/Users/tim/git/howtonode.org.git");
Git("/Users/tim/Code/howtonode.org");
Git.log("articles/what-is-this.markdown", function (err, data) {
  if (err) throw err;
  sys.p(data);
  process.exit();
});

主要指标

概览
名称与所有者creationix/node-git
主编程语言JavaScript
编程语言JavaScript (语言数: 1)
平台
许可证
所有者活动
创建于2010-04-06 22:28:59
推送于2015-03-17 23:23:28
最后一次提交2015-03-17 23:23:28
发布数10
最新版本名称0.0.11 (发布于 )
第一版名称v0.0.1 (发布于 )
用户参与
星数205
关注者数9
派生数30
提交数38
已启用问题?
问题数8
打开的问题数6
拉请求数5
打开的拉请求数3
关闭的拉请求数2
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?