go-branchy

command module
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2024 License: MIT Imports: 1 Imported by: 0

README

go-branchy logo

go-branchy

Written in Go... Logo authored by Midjourney


go-branchy or branchy is a CLI helper which generates/creates git branch names from JIRA tickets (summary field) and automatically copies the branch name to the clipboard.

Motivation

This project has two motivational aspects. The first is that we use a common pattern to create git branch names at work (and we use JIRA... of course). So this is why I created a little tool to create a branch name by just giving the branch type (e.g. feat or fix) and a JIRA issue (e.g. ABC-1234). The result should be the following:

feat/ABC-1234/super-cool-branch-name-created-from-a-jira-summary

The second aspect is the learning aspect. This little tool and the whole repository seem to be a little overloaded for what it really achieves. But I had different goals on what I wanted to learn. These where the things I wanted to learn or at least try out:

  • Building a CLI tool with Cobra
  • Using Task instead of a Makefile
  • Automating the release process with GoReleaser and GitHub Actions
  • Generating the CHANGELOG.md automatically with git-chglog
  • Generating a beautiful logo with ChatGPT and Midjourney
  • And of course also utilizing GitHub Copilot

Installation

Go

go install github.com/untcha/go-branchy@latest

Download the binary

You can download the binary from the GitHub releases page and add it to your $PATH

The go-branchy_<version>_checksums.txt file contains the SHA-256 checksum for each file.

Configuration

In order to use go-branchy you need to export the following two environment variables:

export BRANCHY_JIRA_URL=<the-url-of-your-jira-instance>
export BRANCHY_JIRA_TOKEN=<your-jira-personal-access-token>

Usage

Now you can use branchy very simple:

go-branchy generate feat ABC-1234

or use the alias g instead of generate:

go-branchy g feat ABC-1234

Help

go-branchy help
A little helper tool to create git branch names from JIRA tickets - written in Go

Branchy is a CLI helper which generates/creates git branch names from JIRA tickets (summary field)
and automatically copies the branch name to the clipboard (e.g. feat/ABC-1234/this-is-my-branch-name)

Usage:
  go-branchy [command]

Examples:
go-branchy generate feat ABC-1234
go-branchy g fix ABC-1234

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  generate    Generate a branch name from a JIRA issue summary field
  help        Help about any command
  version     Print the CLI version

Flags:
  -h, --help   help for branchy

Use "go-branchy [command] --help" for more information about a command.

Documentation

Overview

Copyright © 2023 Alexander Untch <alexander@untch.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL