Working on NodeGit
Development

Working on NodeGit

To Git Some Great Cross-Platform Options to Developers

We’re always looking for cool new things to work on at Axosoft and this culminates annually in our 30-day-projects. In last year’s 30-day projects a bunch of us started working on a new way to interact with git.

working on nodegit

One of the things we wanted was a tool that was cross-platform. All of us have different working styles and none of us want to compromise the quality of our tools. So we decided to try something new and different; we decided to make a cross-platform git app using some cool new technologies. We looked into building a git client using nw.js (formerly node-webkit) and Angular JS. The one critical thing we needed was a node module that was cross platform and allowed us to access git.

No good cross-platform git options…

During our 30-day project we decided that our app shouldn’t require a user to have git installed on their machine. It should be completely independent from other 3rd party applications that most git clients rely on (e.g. msysgit/putty on windows and git/OpenSSH on OSX/Linux).

The best option we thought was using libgit2. This is a low level C library that is 100% cross platform. Unfortunately, there were no good ports of this library to Node.js. All of them required some additional work to really get off of the ground. We decided to move forward with a UI demo of our app and if there was any interest, we would come back and try to solve the more technical issues.

All systems go!

After showing off our UI demo at the end of the 30-day project, we got an overall really good response. So Axosoft decided to start backing some of the technologies that we would need to actually bring a product like this to life.

After looking through all of the ports of libgit2 we eventually settled on NodeGit. We reached out to the maintainer of the project Tim Branyen, to see what needed to be done and where we could help. He directed us to help write some of the code that automatically generates the Native Node Module in C++ that wraps the libgit2 library using the supplied libgit2 JSON file from the libgit2 docs page.

Wait what?!?

Yep, NodeGit generates itself. We have some code that we’ll feed some JSON into that will spit out C++. Pretty cool huh? I could talk endlessly about the crazy stuff we needed to do to pull that off, but I think I’ll save that for another post.

So what the heck is NodeGit?

NodeGit is an asynchronous native node module that lets you call into libgit2. That means that a node project that uses NodeGit can do low level git commands without assuming anything about the machine it’s being run on! It even handles the SSH credential auth! On Windows!!!

You don’t need msysgit or a specific version of git installed. Now that would all be handled for you in this neat little libgit2 wrapper. Not only that, but it’s super fast (and going to get faster) not to mention, it doesn’t block for I/O. That means that your app stays super responsive even while cloning large repos or doing anything else.

Big names are already using it!

Any given day we have over 80 people idling in our gitter channel. NodeGit is now being used, or is planned to be used in more and more projects, including Microsoft Azure, GitHub’s Atom editor, Netflix, PayPal and more. We had 7.7 THOUSAND downloads off of NPM in March 2015 and we’re on track to exceed that in April. We’re the 2nd most starred wrapper project for libgit2, beaten only by Rugged, which is what GitHub is built off of.

I’m pretty proud of how far NodeGit has come since Axosoft decided to back it a few months ago and what our awesome team has been able to pull off. I think this project can really drive better git integrations, more complete git clients and help the community create amazing tools leveraging git. And I’m really excited to see what you can do with it as well.

Happy hacking and let us know what you think of our new cross-platform Git client Axosoft GitKraken!

Stay on the cutting edge of software development by getting innovative tips, trends and stories delivered to your inbox every month!

Agile project management software
Plan, develop, review, and ship fast

Visit Axosoft.com

The downright luxurious Git client
For Windows, Mac & Linux

Visit GitKraken.com