A tool for parse a git branch name
buranko
outputs the ID
field by default.
$ git checkout -b feature/1234_foo-bar
$ buranko
1234
Specify an output field.
$ buranko -output LinkID
#1234
$ buranko -output Name
foo-bar
Parse a branch name from stdin.
$ echo 'feature/1234_foo-bar' | buranko
1234
Configuration uses 'git-config' variables.
buranko.template
The template can use the values defined in the following Fields.
This option is useful for pointing to 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#1234
FullName
: Full branch nameAction
: Action typeID
: Issue IDLinkID
: Issue ID with a leading#
Description
: Description
FullName
:feature/1234_foo-bar
Action
:feature
ID
:1234
LinkID
:#1234
Description
:foo-bar
FullName
:foo-bar
Description
:foo-bar
More patterns at parser_test.go
.
Add an issue ID to commit comment using git hook.
GIT-REPO/.git/hooks/prepare-commit-msg
if [ "$2" == "" ]; then
mv $1 $1.tmp
echo `buranko -output LinkID -template` > $1
cat $1.tmp >> $1
fi
To install, use go get
:
$ go get github.com/chocoby/buranko
Or you can download a binary from releases page and place it in $PATH
directory.
- Fork (https://github.com/chocoby/buranko/fork)
- Create a feature branch
- Commit your changes
- Rebase your local changes against the master branch
- Run test suite with the
go test ./...
command and confirm that it passes - Run
gofmt -s
- Create a new Pull Request