Giter VIP home page Giter VIP logo

gittle.js's Introduction

Gittle

A simple Node.js wrapper for the Git CLI. The API uses promises. This library is used in Codebox.

Installation

npm install gittle

How to use it?

var Gittle = require("gittle");
  • Load a repository: var repo = new Gittle("./");
  • Clone a repository: Gittle.clone("https://github.com/FriendCode/gittle.js.git", "./test")
  • Initialize an empty repository: Gittle.init("./test")

Check out Authentication about how to configure https/ssh authentication for cloning.


Repository:

Status
  • Get status: repo.status()
Identity
  • Get identity: repo.identity(), Returns an Actor object
  • Set identity: repo.identify(actor), actor is an object like: {name: "", email: ""}
Push/pull
  • Pull: repo.pull(remote, branch)
  • Push: repo.push(remote, branch)
  • Fetch: repo.fetch(remote)

Check out Authentication about how to configure https/ssh authentication.

Commits

A commit is representated by a Commit object.

  • List all commits: repo.commits(start, limit, skip)
  • Commit changes: repo.commit(message, options)
Tags
  • List all tags: repo.tags()
  • Create a new tag: repo.create_tag(name, options)
  • Delete a tag: repo.delete_tag(name)
Branches

A branch is representated by a Head object.

  • List all branches: repo.branches()
  • Get a branch from its name: repo.branche(name)
  • Create a branch: repo.create_branch(name)
  • Delete a branch: repo.delete_branch(name)
Remotes
  • List all remotes: repo.remotes()
  • Add a remote: repo.remore_add(name, url)
  • Delete a remote: repo.remote_remove(name)

Commit

  • commit.id: (String) id for this commit
  • commit.author: (Actor) author of this commit
  • commit.commiter: (Actor) commiter of this commit
  • commit.message: (String) message for this commit
  • commit.authored_date: (String) date when the commit was authored
  • commit.committed_date: (String) date when the commit was commited
  • Get the files tree for this commit: commit.tree()
  • Get the parents commits: commit.parents()

Actor

  • actor.name: (String) name of this actor
  • actor.email: (String) email address of this actor
  • actor.hash: (String) hash of this actor (md5 hash of the email)

Ref

Class Head inherit from Ref.

  • ref.name: (String) name of this reference
  • ref.commit: (Commit) commit related to this ref.

Authentication

A last argument could be use for authentication on Gittle.clone, repo.push, repo.pull, repo.fetch:

{
    // SSH:
    'passphrase': "...",
    'refuseUnknownHost': true, // Default is false
    
    // HTTPS:
    'username': "...",
    'password': "..."
}

gittle.js's People

Contributors

samypesse avatar aarono avatar

Stargazers

windyge avatar Angus H. avatar Matt Edelman avatar Chris Watson avatar  avatar Michael Anthony avatar Steven avatar Lucio Franco avatar  avatar Joohun, Maeng avatar Antonin Januska avatar Ivan Tugay avatar Abhishek P avatar Yacine Rezgui avatar Christopher Enytc avatar Frank Rousseau avatar  avatar Zaghdoudi Amine avatar Stuart Knightley avatar saksoy avatar  avatar  avatar

Watchers

James Cloos avatar  avatar Michael Anthony avatar  avatar  avatar  avatar

gittle.js's Issues

Unable to pass options to child_process.exec

I ran into a scenario where the stdOut buffer from one of my git commands (via gittle) exceeds the default maxBuffer size for child_process.exec. If I was able to, I'd pass an option down to gittle to increase the maxBuffer. But currently no such feature exists.

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.