Buranko is a CLI tool for parsing and formatting Git branch names.
- Git branch name parsing
- Output formatting using templates
- Field extraction
Download a binary from releases page and place it in $PATH directory.
Display the current branch ID:
burankoFormat the output using a configured template:
buranko --templateTemplate configuration:
git config buranko.template "{Action}/{ID}-{Description}"Available template variables:
{FullName}: Full branch name{Action}: Action (feature, bugfix, etc.){ID}: Branch ID{LinkID}: Link ID (with #){Description}: Branch description
This option is useful for referencing issues in other GitHub repositories, or for software that requires a prefix in the issue number.
$ git checkout -b feature/1234_foo-bar
$ git config buranko.template ABC-{ID}
$ buranko --template
ABC-1234
$ git config buranko.template foo-org/bar-repo#{ID}
$ buranko --template
foo-org/bar-repo#1234Output only a specific field:
buranko --output FullNameAvailable fields:
FullName: Full branch nameAction: ActionID: Branch IDLinkID: Link IDDescription: Branch description
Display all branch information:
buranko --verboseYou can read branch names from stdin:
echo "feature/123-test" | burankoBuranko parses branch names in the following format:
<action>/<id>-<description>
Examples:
feature/123-add-loginbugfix/456-fix-crashhotfix/789-security-patch
More patterns at main.rs.
Add an issue ID to the commit message using a git hook.
[Git repository]/.git/hooks/prepare-commit-msg
if [ "$2" == "" ]; then
mv $1 $1.tmp
echo `buranko -output LinkID -template` > $1
cat $1.tmp >> $1
fi