Skip to content

tamtakoe/git-info-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-info-sync NPM version

get detailed data about current git repo

Install with npm

npm install git-info-sync

Usage

var gitInfo = require('git-info-sync');

gitInfo(['branch', 'shortSHA']); //{ branch: 'master',
                                 //  shortSHA: '3d0723f' }
                                           
gitInfo(); //{ branch: 'master',
           //  SHA: '3d0723ff637020700ca5f6a394b07f27ddb81df2',
           //  shortSHA: '3d0723f',
           //  currentUser: 'someUser',
           //  lastCommitTime: '2015-09-07 19:01:15 +0300',
           //  lastCommitMessage: 'bug fixes\n',
           //  lastCommitAuthor: 'someCommitter',
           //  tag: '0.1.2',
           //  remoteOriginUrl: 'https://someuser@github.com/someproject/somerepo.git' }

API

gitInfo([shortcuts [, commands [, cache]]])

Set attribute shortcuts define composition of the resulting data

Parameters

shortcuts

Type: Array

Default: all shortcuts

Define composition of the resulting data.

commands

Type: Object

Extend collection of default shortcuts of commands:

branch: ['rev-parse', '--abbrev-ref', 'HEAD'],
SHA: ['rev-parse', 'HEAD']
shortSHA: ['rev-parse', '--short', 'HEAD']
currentUser: ['config', '--global', 'user.name']
lastCommitTime: ['log', '--format="%ai"', '-n1', 'HEAD']
lastCommitMessage: ['log', '--format="%B"', '-n1', 'HEAD']
lastCommitAuthor: ['log', '--format="%aN"', '-n1', 'HEAD']
tag: ['describe', '--always', '--tag', '--abbrev=0']
remoteOriginUrl: ['config', '--get-all', 'remote.origin.url']
cache

Type: Boolean

Default: true

Cache git info

License

© Oleg Istomin 2015. Released under the MIT license

About

Get detailed data about current git repo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published