Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

buranko

Build Status

A tool for parse a git branch name

Usage

buranko outputs the ID field by default.

$ git checkout -b feature/1234_foo-bar
$ buranko
1234
$ buranko -ref
#1234

Specify an output field.

$ buranko -output Name
foo-bar

Parse a branch name from stdin.

$ echo 'feature/1234_foo-bar' | buranko
1234

Configuration

Configuration uses 'git-config' variables.

buranko.reponame

A repository name. To output a repository name, use -reponame option.

This is useful for commit across the GitHub repository.

$ git config buranko.reponame foo-org/bar-repo
$ git checkout -b feature/1234_foo-bar
$ buranko -ref -reponame
foo-org/bar-repo#1234

Fields

  • FullName: Full branch name
  • Action: Action type
  • ID: Issue ID
  • Description: Description

Parse patterns

feature/1234_foo-bar

  • FullName: feature/1234_foo-bar
  • Action: feature
  • ID: 1234
  • Description: foo-bar

foo-bar

  • FullName: foo-bar
  • Description: foo-bar

More patterns at parser_test.go.

Integrate with prepare-commit-msg

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 -ref -reponame` > $1
    cat $1.tmp >> $1
fi

Install

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.

Contribution

  1. Fork (https://github.com/chocoby/buranko/fork)
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the go test ./... command and confirm that it passes
  6. Run gofmt -s
  7. Create a new Pull Request

GitHub

https://github.com/chocoby/buranko

You can’t perform that action at this time.