Code Monkey home page Code Monkey logo

gity-1's Introduction

gity

NPM version build status license

A nice Git wrapper for Node.

npm install gity

Features

  • Simple, chainable API
  • Small and only one dependency
  • Supports all of the most common git commands
  • By default, provides nicely parsed output from commands like status and log

Examples

var Git = require('gity');

var git = Git()
  .add('*.js')
  .commit('-m "added js files"')
  .run();
var Git = require('gity');

var git = Git()
  .add('*.js')
  .commit('-m "added js files"')
  .status()
  .run(function(err, res){
    // ... { untracked: [], modified: [], created: [], deleted: [] };
  });
var Git = require('gity');

var git = Git({ pretty: false }) // passes stdout into res
  .add('*.js')
  .commit('-m "added js files"')
  .status()
  .run(function(err, res){
    // ...
  });
var Git = require('gity');

var git = Git({ base: '../repo' }) // sets the base folder to '../repo'
  .init()
  .run(function(err, res){
    // ...
  });

API

Git(options)

Create a new instance of Gity.

The available options are:

  • base: set the base folder to run the command from, default process.cwd().
  • pretty: give pretty output instead of stdout, default true.

.add()

git.add('-A');
git.add('*.js');
git.add('--All');
git.add('index.js');

.bisect()

git.bisect('start');
git.bisect('bad');
git.bisect('good');

.branch()

git.branch(); // (e.g. 'master')
git.branch('-D feature');

.checkout()

git.checkout('feature');
git.checkout('-b demo');

.clone()

git.clone('git://git.kernel.org/pub/scm/.../linux.git my-linux');

.commit()

git.commit('--short');
git.commit('-m "testing"');

.diff()

git.diff('topic master');
git.diff('Readme.md package.json');
git.diff('git diff --name-status');

.fetch()

git.fetch();
git.fetch('origin');

.grep()

git.grep("'time_t' -- '*.[ch]'");

.init()

git.init();
git.init('-q');

.log()

git.log();
git.log('git log --no-merges');
git.log('git log --since="2 weeks ago" -- gitk');

.merge()

git.merge('origin/next');

.mv()

git.mv('oldname newname');

.pull()

git.pull();
git.pull('origin master');

.push()

git.push()
git.push('origin master');
git.push('-f origin master');

.rebase()

git.rebase('master');
git.rebase('--onto master next topic');

.reset()

git.reset();
git.reset('--soft HEAD^');
git.reset('--hard HEAD~3');

.rm()

git.rm('oldname');

.show()

git.show('--pretty="format:" --name-only bd61ad98');

.status()

git.status();
git.status('--porcelain');

.tag()

git.tag('-d X');

.run()

git.run();
git.run(function(err, res){
  if (err) throw err;
  console.log(res);
});

License

MIT

gity-1's People

Contributors

d3m0n-r00t avatar jamieslome avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.