git-head-info ·
Retrieve current sha and branch name from a git repo.
Install
npm i git-head-info
Usage
/** * @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