GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ashwinraghav/nodegit: Native Node bindings to Git.

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

1,161 Commits
1,161 Commits

Folders and files

NameName
Last commit message
Last commit date
example
example
 
 
generate
generate
 
 
lib
lib
 
 
test
test
 
 
vendor
vendor
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
.jshintrc
.jshintrc
 
 
.npmignore
.npmignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
appveyor.yml
appveyor.yml
 
 
install.js
install.js
 
 
package.json
package.json
 
 

Repository files navigation

NodeGit

Node bindings to the libgit2 project.

Build Status Build Status: Windows

Stable: 0.1.4

Maintained by Tim Branyen @tbranyen, Michael Robinson @codeofinterest, John Haley @johnhaley81, Nick Kallen @nk, and Max Korp @maxkorp with help from awesome contributors!

API Documentation.

http://www.nodegit.org/

Getting started.

NodeGit will work on most systems out-of-the-box without any native dependencies.

npm install nodegit

If you encounter problems while installing, you should try the Building from source instructions below.

Please note that nodegit is undergoing a large scale refactoring at the moment. Please continue reporting bugs, but note that until the upcoming 0.1 release they are unlikely to be fixed. Older versions of the API will not be supported.

Building from source.

Minimum dependencies:

  • Python 2

If you wish to help contribute to nodegit it is useful to build locally.

# Fetch this project.
git clone git://github.com/tbranyen/nodegit.git

# Enter the repository.
cd nodegit

# Installs the template engine, run the code generation script, and build.
npm install

If you encounter errors, you most likely have not configured the dependencies correctly.

Installing dependencies:

Mac OS X

  • Install XCode Command Line Tools

Linux

Using APT in Ubuntu:

sudo apt-get install build-essential

Using Pacman in Arch Linux:

sudo pacman -S base-devel

Windows

  • Download and install Python.
  • Download and install VS Express.

You may have to add a build flag to the installation process to successfully install. Try first without, if the build fails, try again with the flag.

Allegedly the order in which you install Visual Studio could trigger this error.

npm install nodegit --msvs_version=2013
# Or whatever version you've installed.

API examples.

Cloning a repository and reading a file:

var clone = require("nodegit").Repository.clone;

// Clone a given repository into a specific folder.
clone("https://github.com/nodegit/nodegit", "tmp", null)
  // Look up this known commit.
  .then(function(repo) {
    // Use a known commit sha from this repository.
    return repo.getCommit("59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5");
  })
  // Look up a specific file within that commit.
  .then(function(commit) {
    return commit.getEntry("README.md");
  })
  // Get the blob contents from the file.
  .then(function(entry) {
    return entry.getBlob();
  })
  // Display information about the blob.
  .then(function(blob) {
    // Show the name, sha, and filesize in byes.
    console.log(entry.name() + entry.sha() + blob.size() + "b");

    // Show a spacer.
    console.log(Array(72).join("=") + "\n\n");

    // Show the entire file.
    console.log(String(blob));
  });

Emulating git log:

var open = require("nodegit").Repository.open;

// Open the repository directory.
open("tmp")
  // Open the master branch.
  .then(function(repo) {
    return repo.getMaster();
  })
  // Display information about commits on master.
  .then(function(branch) {
    // Create a new history event emitter.
    var history = branch.history();

    // Create a counter to only show up to 9 entries.
    var count = 0;

    // Listen for commit events from the history.
    history.on("commit", function(commit) {
      // Disregard commits past 9.
      if (++count >= 9) {
        return;
      }

      // Show the commit sha.
      console.log("commit " + commit.sha());

      // Store the author object.
      var author = commit.author();

      // Display author information.
      console.log("Author:\t" + author.name() + " <", author.email() + ">");

      // Show the commit date.
      console.log("Date:\t" + commit.date());

      // Give some space and show the message.
      console.log("\n    " + commit.message());
    });

    // Start emitting events.
    history.start();
  });

Unit tests.

You will need to build locally before running the tests. See above.

npm test

About

Native Node bindings to Git.

www.nodegit.org/

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.