Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@sinet/git-refs

sinet27MIT2.0.1

Determine references of a git repository via JavaScript

readme

Git Refs

Build Status Dependency Status devDependency Status

JavaScript implementation to get the git commit hashes for different references.

  • <input checked="" disabled="" type="checkbox"> current branch (current)
  • <input checked="" disabled="" type="checkbox"> local branches (heads)
  • <input checked="" disabled="" type="checkbox"> remote branches (remotes)
  • <input disabled="" type="checkbox"> tags (tags)

Tags aren't currently implemented, because they require being able to read the tag commit object. The other references just require reading the file contents.

Usage

npm install @sinet/git-refs --save

Example

const gitRefs = require( '@sinet/git-refs' );

gitRefs( '/path/to/.git', function ( error, refs ) {
    if ( error ) {
        return console.log( error );
    }

    console.log( "refs.current.head:", refs.current.head );
    console.log( refs );
} );

Contributing

All pull requests must follow coding conventions and standards.