careful
v1.1.0
Published
Validate git branch names according to git-flow
Downloads
40
Maintainers
Readme
careful
Provides a binary that can be used as a git-hook
to validate branch names according to git-flow
prior to pushing upstream.
$ (features/banned-regex-support) careful
CAREFUL! Branch prefix "features" is not allowed.
CAREFUL! Instead of "features/banned-regex-support" try "feature/banned-regex-support".
Features
- Validate branch name according to default
git-flow
format. - Prevent pushes to certain branches such as
master
orstaging
. - Completely customizable, from prefix seperator to the error messages themselves.
- Give suggestions when prefixes don't exist.
Installation
$ npm install careful --save-dev
- Use ghooks to setup
pre-push
andpre-commit
git hooks. Requiresgit 1.8.2+
- Use
-g
to install globally to getcareful
command everywhere.
Usage
Options
Define options in your package.json
file (values displayed below are the default values):
{
"config": {
"careful": {
// Allowed git-flow prefixes (e.g. <prefix>/<name>)
// Example: feature/banned-regex-support
"prefixes": ["feature", "hotfix", "release"],
// Commonly misspelled or forgotten?
// Add a suggestion for when it occurs
"suggestions": {
"features": "feature",
"feat": "feature",
"fix": "hotfix",
"releases": "release"
},
// Skip validation check completely for certain branches
// MUST be full branch name including prefixes
"skip": [],
// Branches developers are disallowed to push code
// MUST be full branch name including prefixes
"disallowed": ["master", "staging", "develop"],
// Ban a branch name completely from being used regardless of prefix
"banned": ["wip"],
// Prefix to name seperator
"seperator": "/"
}
}
}
skip
Skip all checks for certain branches.
prefixes
git-flow
branch prefixes allowed.
suggestions
Give suggestions when a certain prefix is used.
Instead of "features/banned-regex-support" try "feature/banned-regex-support"
disallowed
Prevent pushing to certain branches, must be the entire branch name, including prefixes.
seperator
Character used to seperate the prefix
and branch name
. Defaults to /
, as Sourcetree converts branch names that use /
into folders.
banned
Ban pushing to branches with a certain name
. Checks both complete branch name, and the name of the branch with the prefix omitted.
msgBranchBanned
Message displayed when a banned branch name is used.
msgPrefixNotAllowed
Message displayed when a prefix that is not allowed is used.
msgPrefixSuggestion
Message displayed when a suggestion for a prefix exists.
msgSeperatorRequired
Message displayed when the branch is missing the seperator.
License
MIT