All Projects → nodegit → Nodegit

nodegit / Nodegit

Licence: mit
Native Node bindings to Git.

Programming Languages

javascript
184084 projects - #8 most used programming language
C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to Nodegit

mit-phd-thesis
MIT Ph.D. Thesis in LaTeX
Stars: ✭ 52 (-98.96%)
Mutual labels:  mit
Node Rsync
Rsync wrapper for Node.js
Stars: ✭ 256 (-94.9%)
Mutual labels:  mit
Pepy
pepy is a site to get statistics information about any Python package.
Stars: ✭ 369 (-92.65%)
Mutual labels:  mit
uuix
A tiny (<1KB) and fast UUID (v4) generator for Crystal
Stars: ✭ 17 (-99.66%)
Mutual labels:  mit
flutter vertical marquee
flutter vertical marquee
Stars: ✭ 15 (-99.7%)
Mutual labels:  mit
Mit6.828 os
MIT 6.828 Lab https://pdos.csail.mit.edu/6.828/2018/schedule.html
Stars: ✭ 265 (-94.72%)
Mutual labels:  mit
LAB
MIT IT Lab Repository
Stars: ✭ 23 (-99.54%)
Mutual labels:  mit
Cc
一个基于angular5.0.0+ng-bootstrap1.0.0-beta.8+bootstrap4.0.0-beta.2+scss的后台管理系统界面(没基础的同学请先自学基础,谢谢!)
Stars: ✭ 416 (-91.72%)
Mutual labels:  mit
git-documentdb
Offline-first Database that Syncs with Git
Stars: ✭ 20 (-99.6%)
Mutual labels:  nodegit
Godot Platformer 2d
2d Metroidvania-inspired game for the 2019 GDquest Godot Kickstarter course project.
Stars: ✭ 365 (-92.73%)
Mutual labels:  mit
edX-6.00.2x-Introduction-to-Computational-Thinking-and-Data-Science
MIT edX 6.00.2x Introduction to Computational Thinking and Data Science problem sets code
Stars: ✭ 62 (-98.77%)
Mutual labels:  mit
summaly
🔍 Get a summary of any web page
Stars: ✭ 18 (-99.64%)
Mutual labels:  mit
Chariot
A cross-platform open-source reimplementation of the Age of Empires (1997) engine
Stars: ✭ 284 (-94.34%)
Mutual labels:  mit
lectures and talks
Collection of lectures and talks I've given on Computer Vision and Deep Learning
Stars: ✭ 29 (-99.42%)
Mutual labels:  mit
Leopotamgrouplibraryunity
Tools library for unity 3d game engine: animator graph helpers, serialization (json), localization, event routing (eventbus, ui actions), embedded scripting, uGui xml markup, threading, tweening, in-memory protection and other helpers (pure C#)
Stars: ✭ 373 (-92.57%)
Mutual labels:  mit
zork
Full C++-17 port of the 616-point version of Zork from MIT circa 1978-1981
Stars: ✭ 16 (-99.68%)
Mutual labels:  mit
React Native Wechat
🚀 WeChat login, share, favorite and payment for React-Native on iOS and Android platforms (QQ: 336021910)
Stars: ✭ 2,842 (-43.41%)
Mutual labels:  mit
Introtodeeplearning
Lab Materials for MIT 6.S191: Introduction to Deep Learning
Stars: ✭ 4,955 (-1.33%)
Mutual labels:  mit
Citgm
Canary in the Gold Mine
Stars: ✭ 405 (-91.94%)
Mutual labels:  mit
Myra
UI Library for MonoGame, FNA and Stride
Stars: ✭ 348 (-93.07%)
Mutual labels:  mit

NodeGit

Node bindings to the libgit2 project.

Actions Status

Stable ([email protected]): 0.28.3

Have a problem? Come chat with us!

Visit slack.libgit2.org to sign up, then join us in #nodegit.

Maintained by

Tyler Ang-Wanek @twwanek with help from tons of awesome contributors!

Alumni Maintainers

Tim Branyen @tbranyen, John Haley @johnhaley81, Max Korp @maxkorp, Steve Smith @orderedlist, Michael Robinson @codeofinterest, and Nick Kallen @nk

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 receive errors about libstdc++, which are commonly experienced when building on Travis-CI, you can fix this by upgrading to the latest libstdc++-4.9.

In Ubuntu:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install libstdc++-4.9-dev

In Travis:

addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - libstdc++-4.9-dev

In CircleCI:

  dependencies:
    pre:
      - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
      - sudo apt-get update
      - sudo apt-get install -y libstdc++-4.9-dev

If you receive errors about lifecycleScripts preinstall/install you probably miss libssl-dev In Ubuntu:

sudo apt-get install libssl-dev

You will need the following libraries installed on your linux machine:

  • libpcre
  • libpcreposix
  • libkrb5
  • libk5crypto
  • libcom_err

When building locally, you will also need development packages for kerberos and pcre, so both of these utilities must be present on your machine:

  • pcre-config
  • krb5-config

If you are still encountering problems while installing, you should try the Building from source instructions.

API examples.

Cloning a repository and reading a file:

var Git = require("nodegit");

// Clone a given repository into the `./tmp` folder.
Git.Clone("https://github.com/nodegit/nodegit", "./tmp")
  // 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) {
    // Patch the blob to contain a reference to the entry.
    return entry.getBlob().then(function(blob) {
      blob.entry = entry;
      return blob;
    });
  })
  // Display information about the blob.
  .then(function(blob) {
    // Show the path, sha, and filesize in bytes.
    console.log(blob.entry.path() + blob.entry.sha() + blob.rawsize() + "b");

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

    // Show the entire file.
    console.log(String(blob));
  })
  .catch(function(err) { console.log(err); });

Emulating git log:

var Git = require("nodegit");

// Open the repository directory.
Git.Repository.open("tmp")
  // Open the master branch.
  .then(function(repo) {
    return repo.getMasterCommit();
  })
  // Display information about commits on master.
  .then(function(firstCommitOnMaster) {
    // Create a new history event emitter.
    var history = firstCommitOnMaster.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();
  });

For more examples, check the examples/ folder.

Unit tests.

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

npm test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].