branch-name
Get the current branch name or fallback to one
Installation
npm install branch-name --save
Usage
Get it into your program.
const branchName = require('branch-name');
Get the current branch name.
branchName.get().then(function (name) {
console.log(name);
});
Get the current branch name, but with a fallback result for detached head and non-repository situations.
branchName.assume('dev').then(function (name) {
console.log(name);
});
Get the current branch name, with the default master
as a fallback.
branchName.assumeMaster().then(function (name) {
console.log(name);
});
Contributing
See our contributing guidelines for more details.
- Fork it.
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request.
License
MPL-2.0
Go make something, dang it.