node-git

Node.JS library to read git repositories.

  • Owner: creationix/node-git
  • Platform:
  • License::
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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();
});

Main metrics

Overview
Name With Ownercreationix/node-git
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 1)
Platform
License:
所有者活动
Created At2010-04-06 14:28:59
Pushed At2015-03-17 15:23:28
Last Commit At2015-03-17 10:23:28
Release Count10
Last Release Name0.0.11 (Posted on )
First Release Namev0.0.1 (Posted on )
用户参与
Stargazers Count205
Watchers Count10
Fork Count30
Commits Count38
Has Issues Enabled
Issues Count8
Issue Open Count6
Pull Requests Count5
Pull Requests Open Count3
Pull Requests Close Count2
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private