git-is-branch-protected
Checks whether current Git branch is protected
Install
$ npm install git-is-branch-protected
Usage
const gitIsBranchProtected = async { // currently on "master" branch await //=> true await //=> true await //=> true await //=> false await //=> false await //=> true await //=> false}
API
gitIsBranchProtected([currentBranch], [protectedBranches], [options])
Returns true
or false
indicating whether a branch is protected.
currentBranch
Type: string
The name of the current branch. Defaults to check the actual branch name of the current directory.
protectedBranches
Type: Array
Default: ['master', 'develop']
Which branches you would like to protect. By default, master
and develop
are protected.
options
Type: Object
caseSensitive
Type: boolean
Default: false
Whether the check should be performed case sensitive.
License
MIT © Tobias Büschel