gitbump

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

README

git-bump

Easily tag new versions (semver) with git.

Install CLI

Using go:

go install git.sr.ht/~timharek/git-bump/cmd/git-bump@latest
Using Homebrew
brew tap timharek/tap
brew install git-bump

Adding more methods in the future. Help is wanted to achieve the best coverage.

Using pre-compiled binary

Select the version you want to install [available releases] and download it and add it to your bin or something similar.

Example:

wget https://git.sr.ht/~timharek/git-bump/refs/download/<release>/git-bump-<version>-linux-amd64.tar.gz
tar xf git-bump-<version>-linux-amd64.tar.gz
cd git-bump-<version>
cp git-bump /usr/local/bin

Usage

# Get help
git bump -h

# Bump version, defaults to patch
git bump
# Output: v0.0.1 (if first semver)

# Bump version and include shortlog between current commit and previous tag.
git bump --shortlog

# Bump version with message(s)
git bump --message "Feat 1" --message "Fix 2"

# Bump minor version
git bump --minor
# Output: v0.1.0 (if first semver)

# Bump major version
git bump --major
# Output: v1.0.0 (if first semver)

# Undo (delete) tag
git bump undo

# Undo (delete) tag from remote origin
git bump undo --remote origin

Bumping minor will reset patch, and bumping major will reset minor and patch.

Things to know

  • --help will not work when running in git bump, but will work in git-bump.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Path string = ""

Where to execute the git/bump commands

Functions

func AddTag

func AddTag(tag *Tag, msg []string) error

Tag current commit with tag.

func AddTagStr

func AddTagStr(tagStr string) error

Tag current commit with tagStr.

func DeleteTag

func DeleteTag(tag *Tag) error

Delete tag.

func DeleteTagRemote

func DeleteTagRemote(tag *Tag, remote string) error

Delete from remote tag.

func PushTag

func PushTag(tag *Tag, remote string) error

Push tag to remote.

func Shortlog

func Shortlog(rev1, rev2 string) (string, error)

Shortlog between rev1 and rev2.

Example: git shortlog abc1234..HEAD

Types

type Tag

type Tag struct {
	Prefix string `json:"prefix,omitempty"`
	Major  int    `json:"major"`
	Minor  int    `json:"minor"`
	Patch  int    `json:"patch"`
}

func CurrentTag

func CurrentTag() (*Tag, error)

func ListTags

func ListTags() ([]*Tag, error)

func ParseTagString

func ParseTagString(tagStr string) (*Tag, error)

Parse tagStr to a valid semver tag.

func (*Tag) IncrementMajor

func (t *Tag) IncrementMajor()

func (*Tag) IncrementMinor

func (t *Tag) IncrementMinor()

func (*Tag) IncrementPatch

func (t *Tag) IncrementPatch()

func (*Tag) String

func (t *Tag) String() string

Directories

Path Synopsis
cmd
git-bump command
internal
cmd

Jump to

Keyboard shortcuts

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