git-branch-name
v1.1.0
Published
get the directory's git branchName
Downloads
3,885
Readme
git-branch-name
Get the directory's git branchName by nodejs, support git submodule
Install
npm install git-branch-name --save
Use
var getGitBranchName = require('git-branch-name');
var dirPath = path.resolve(__dirname, '../');
getGitBranchName(dirPath, function(err, branchName) {
console.log(branchName); // master
});
How
Parse the output of git branch --work-tree=dirPath --git-dit=dirPath/.git
License
MIT © 2015 sobear