0.1.2 • Published 5 years ago

git-head-info v0.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

git-head-info · GitHub npm CircleCI branch

Retrieve current sha and branch name from a git repo.

Install

npm i git-head-info

Usage

import gitHeadInfo from 'git-head-info' /* or */ const gitHeadInfo = require('git-head-info')

/**
 * @param {path | void} repo: the git repo to get HEAD info, default is current working dir
 * @returns ({
 *  repo: the repo used to get git info
 *  sha: HEAD sha
 *  branch: HEAD branch | undefined(if in `detached HEAD` state)
 * })
 */

// promise
gitHeadInfo(repo?).then(res => {
  ...
}).catch()

// async
async function foo() {
  try {
    const res = await gitHeadInfo(repo?)
    ...
  } catch() {}
}
0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago