Questions tagged [nodegit]

nodegit is a collection of non-blocking Node.js libgit2 bindings, raw api, convenience api, unit tests, documentation and accomodations to make contributing easier.

NodeGit is a collection of non-blocking Node.js libgit2 bindings, raw api, convenience api, unit tests, documentation and accomodations to make contributing easier.

Official Website

API Documentation

110 questions
14
votes
2 answers

Nodegit: How to modify a file and push the changes?

Looked around for an example, but couldn't find one. The documentation is not explained and I could not figure it out. How to modify a file (README.md for example), create a commit for the modified file and then push the commit to the server…
user2445124
11
votes
2 answers

Switch Branch/Tag with nodegit

I have been trying all morning to open an existing repo and change branch or tag using nodegit. The documentation is extensive but seems to be out of date. Any ideas on what I'm doing wrong? var NodeGit = require("nodegit"); var open =…
ngourley
  • 243
  • 2
  • 8
8
votes
1 answer

Getting all commits on all branches with nodegit

I'm writing a little app that analyses the git repositories inside a folder. I'm using nodegit to parse the repo which is based on libgit2. How can I get all the commits from all the branches in a repo using nodegit? Here is my current code: var git…
Calin Leafshade
  • 1,195
  • 1
  • 12
  • 22
7
votes
1 answer

Nodegit - How do I stage and commit a file? (simple example!)

Using Node-git I just want to: Open a repo (where a file has been written/updated) Stage the file Do commit Using the git cli I would write something like this cd repo git add file.js git commit -m "Added file.js" I'm trying to follow the…
Einar
  • 133
  • 1
  • 8
7
votes
2 answers

Nodegit - get diff between two commits

I have two branches master and master.min in my repo. Suppose my current branch is master.min. My master branch is at commit - abcd Some pushes occur to master branch - efgh, ijkl I store the current commit of my master branch: …
adnan kamili
  • 8,967
  • 7
  • 65
  • 125
6
votes
0 answers

nodegit - how to get lines added/removed in a commit filewise?

I am new to nodegit. I want to see most recent 10 commits for a repo, files changed and changes introduced in respective commits. I have got list of 10 most recent commits, but I am stuck on getting commit details. Here is the code that I am…
srikant
  • 260
  • 3
  • 11
6
votes
2 answers

Reading Git config variable using NodeGit

NodeGit does not seem to be providing any API to retrieve Git configuration values. See http://www.nodegit.org/#Config I was expecting something like Config#getValue() or similar API to retrieve configuration values. Perhaps, it is missing in…
Kiran M N
  • 424
  • 1
  • 6
  • 15
6
votes
1 answer

How to clone git repository with nodegit using ssh

I'm trying to clone git repository from our teamforge server in node.js using library nodegit (version 0.2.4) and ssh. Our server requests authentication from user and when I was trying to use only clone method without passing options I was getting…
yezior
  • 867
  • 11
  • 18
5
votes
1 answer

How to get commit sha from tag name with nodegit?

I have this: nodegit.Reference .lookup(repo, `refs/tags/${tagName}`) .then(ref => nodegit.Commit.lookup(repo, ref.target())) .then(commit => ({ tag: tagName, hash: commit.sha(), date: commit.date().toJSON(), })) This code works…
Anna B
  • 5,997
  • 5
  • 40
  • 52
5
votes
2 answers

Using nodegit, how can I find the date a given file was last updated in a git repo?

I'm trying to use nodegit to treat git as a db for content. As such, I'm writing functions to access content in the repo. I'm able to retrieve a file blob and other info about a given file, but I'm struggling to get timestamp information. I'd like…
fraxture
  • 5,113
  • 4
  • 43
  • 83
5
votes
1 answer

javascript nodegit unable to find remote

Folks, I have a branch called user/foo that I'd like to check out from remote. Code: Git.prototype.refresh = function refresh(branch) { var options = { credentials: function() { return…
Cmag
  • 14,946
  • 25
  • 89
  • 140
4
votes
3 answers

Incorrect NODE_MODULE_VERSION when using ava

I write an Electron app that uses nodegit. For my test part I use ava in combination with Spectron to test my app. All of my tests work - including functions which use nodegit in my app. In addition to the tests described above I made also a pure…
Daniel Stephens
  • 2,371
  • 8
  • 34
  • 86
4
votes
0 answers

List different commits between two branches by using nodegit

In my program, I'm using nodegit. I'm able to list commits using nodegit: var nodegit = require("nodegit"); var path = require("path"); var fs = require("fs"); var shas = []; var names= []; var mess= []; var sums= []; var time =[]; let promise =…
G.Szymon
  • 41
  • 2
4
votes
1 answer

How add directory or all files in a directory by nodegit?

I am new on node js and on git as well, i am building an app that will write results on text files and will push on git rapidly. After many struggle I have figured out following code that is writing file and pushing on github. But I am seeking a way…
Mian Majid
  • 814
  • 2
  • 8
  • 22
4
votes
1 answer

NodeGit how do I get a list of local branches?

I'm writing a node API server that needs to send user a list of local branches in a git repo residing on the server. A lot of places suggest using the Repository#getReferenceNames from NodeGit and this is what I do: exports.getBranches = function…
Calvin Hu
  • 3,595
  • 4
  • 18
  • 23
1
2 3 4 5 6 7 8