| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,63 +3,96 @@ layout: default | |||
| 3 | 3 | menu_item: getting_started | |
| 4 | 4 | sections: | |
| 5 | 5 | "About": "#about" | |
| 6 | - "Installing NodeGit": "#installing-nodegit" | ||
| 6 | + "Quick install": "#quick-install" | ||
| 7 | + "Include library": "#include-library" | ||
| 7 | 8 | "Cloning a Repository": "#cloning-a-repository" | |
| 9 | + "Opening a Repository": "#opening-a-repository" | ||
| 10 | + "Brought to you by...": "#brought-to-you-by" | ||
| 8 | 11 | "Used by...": "#used-by" | |
| 9 | 12 | ||
| 10 | 13 | --- | |
| 11 | 14 | ||
| 12 | - ## <a name="installing-nodegit"></a>Installing NodeGit | ||
| 15 | + ## <a name="about"></a>About NodeGit | ||
| 13 | 16 | ||
| 14 | - First, let’s make a directory to experiment with NodeGit. | ||
| 17 | + If you are working with low-level Git operations and want excellent | ||
| 18 | + performance, NodeGit is for you. This project provides well tested, cross | ||
| 19 | + platform bindings to the [libgit2](https://libgit2.github.com) library for | ||
| 20 | + Node. | ||
| 15 | 21 | ||
| 16 | - ```bash | ||
| 17 | - $ mkdir ~/start-with-nodegit | ||
| 18 | - $ cd ~/start-with-nodegit | ||
| 22 | + ### Current stable version: 0.3.0 | ||
| 23 | + | ||
| 24 | + <table> | ||
| 25 | + <thead> | ||
| 26 | + <tr> | ||
| 27 | + <th>Linux</th> | ||
| 28 | + <th>OS X</th> | ||
| 29 | + <th>Windows</th> | ||
| 30 | + <th>Dependencies</th> | ||
| 31 | + </tr> | ||
| 32 | + </thead> | ||
| 33 | + <tbody> | ||
| 34 | + <tr> | ||
| 35 | + <td colspan="2" align="center"> | ||
| 36 | + <a href="https://travis-ci.org/nodegit/nodegit"><img src="https://travis-ci.org/nodegit/nodegit.svg"></a> | ||
| 37 | + </td> | ||
| 38 | + <td align="center"> | ||
| 39 | + <a href="https://ci.appveyor.com/project/timbranyen/nodegit"><img src="https://ci.appveyor.com/api/projects/status/e5a5q75l9yfhnfv2?svg=true"></a> | ||
| 40 | + </td> | ||
| 41 | + <td align="center"> | ||
| 42 | + <a href="https://david-dm.org/nodegit/nodegit"><img src="https://david-dm.org/nodegit/nodegit.svg"></a> | ||
| 43 | + </td> | ||
| 44 | + </tr> | ||
| 45 | + </tbody> | ||
| 46 | + </table> | ||
| 47 | + | ||
| 48 | + ## <a name="quick-install"></a>Quick install | ||
| 49 | + | ||
| 50 | + NodeGit can be quickly and painlessly installed via NPM: | ||
| 51 | + | ||
| 52 | + ``` bash | ||
| 53 | + npm install nodegit | ||
| 19 | 54 | ``` | |
| 20 | 55 | ||
| 21 | - NodeGit can be installed using npm, the node package manager. If you don’t have node installed on your machine, you can download and install the node binaries for your OS. Once node is installed, open your Terminal and install NodeGit. | ||
| 56 | + For more comprehensive installation techniques, check out the [Install Guides]( | ||
| 57 | + /guides/install | ||
| 58 | + ) | ||
| 22 | 59 | ||
| 23 | - ```bash | ||
| 24 | - $ npm install nodegit | ||
| 60 | + ## <a name="include-library"></a>Include library | ||
| 61 | + | ||
| 62 | + You simply need to require NodeGit in your project to start using it. | ||
| 63 | + | ||
| 64 | + ``` javascript | ||
| 65 | + var Git = require("nodegit"); | ||
| 25 | 66 | ``` | |
| 26 | 67 | ||
| 27 | 68 | ## <a name="cloning-a-repository"></a>Cloning a Repository | |
| 28 | 69 | ||
| 29 | - First, let’s learn how to clone a repository. Let’s create a file named `clone.js`, and input the following code. | ||
| 30 | - | ||
| 31 | - ```js | ||
| 32 | - var NodeGit = require("nodegit"); | ||
| 33 | - | ||
| 34 | - // Clone a given repository into a specific folder. | ||
| 35 | - NodeGit.Clone.clone("https://github.com/nodegit/nodegit", "tmp", null) | ||
| 36 | - // Look up this known commit. | ||
| 37 | - .then(function(repo) { | ||
| 38 | - // Use a known commit sha from this repository. | ||
| 39 | - return repo.getCommit("59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5"); | ||
| 40 | - }) | ||
| 41 | - // Look up a specific file within that commit. | ||
| 42 | - .then(function(commit) { | ||
| 43 | - return commit.getEntry("README.md"); | ||
| 44 | - }) | ||
| 45 | - // Get the blob contents from the file. | ||
| 46 | - .then(function(entry) { | ||
| 47 | - // Patch the blob to contain a reference to the entry. | ||
| 48 | - return entry.getBlob().then(function(blob) { | ||
| 49 | - blob.entry = entry; | ||
| 50 | - return blob; | ||
| 51 | - }); | ||
| 52 | - }) | ||
| 53 | - // Display information about the blob. | ||
| 54 | - .then(function(blob) { | ||
| 55 | - // Show the name, sha, and filesize in byes. | ||
| 56 | - console.log(blob.entry.name() + blob.entry.sha() + blob.size() + "b"); | ||
| 57 | - | ||
| 58 | - // Show a spacer. | ||
| 59 | - console.log(Array(72).join("=") + "\n\n"); | ||
| 60 | - | ||
| 61 | - // Show the entire file. | ||
| 62 | - console.log(String(blob)); | ||
| 63 | - }) | ||
| 64 | - .catch(function(err) { console.log(err); }); | ||
| 70 | + Let's learn how to clone a repository. Create a file named `clone.js`, | ||
| 71 | + and add the following code: | ||
| 72 | + | ||
| 73 | + ``` javascript | ||
| 74 | + Git.Clone("https://github.com/nodegit/nodegit", "tmp").then(function(repository) { | ||
| 75 | + | ||
| 76 | + }); | ||
| 65 | 77 | ``` | |
| 78 | + | ||
| 79 | + ## <a name="opening-a-repository"></a>Opening a Repository | ||
| 80 | + | ||
| 81 | + Let's learn how to open a repository. Create a file named `open.js`, | ||
| 82 | + and add the following code: | ||
| 83 | + | ||
| 84 | + ``` javascript | ||
| 85 | + Git.Repository.open("tmp").then(function(repository) { | ||
| 86 | + | ||
| 87 | + }); | ||
| 88 | + ``` | ||
| 89 | + | ||
| 90 | + ## <a name="brought-to-you-by"></a>Brought to you by... | ||
| 91 | + | ||
| 92 | + A lot of talented developers over the world. We are proud to be sponsored by | ||
| 93 | + the following companies to continue work on making NodeGit one of the best | ||
| 94 | + native node modules around! | ||
| 95 | + | ||
| 96 | + <img width=100 src="/img/Axosoft-Logo-Revision_crop.png"> | ||
| 97 | + <img width=100 src="/img/bocoup-horizontal-100.png"> | ||
| 98 | + <img width=100 src="/img/GitHub_Logo.png"> | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments