LinuxCommandLibrary

git-release

Automate Git repository releases

TLDR

Create and push a release

$ git release [tag_name]
copy

Create and push a signed release
$ git release [tag_name] -s
copy

Create and push a release with a message
$ git release [tag_name] -m "[message]"
copy

SYNOPSIS

git release [major|minor|patch|prerelease|hotfix] [release notes] [options]

PARAMETERS

major|minor|patch|prerelease|hotfix
    Version bump type (positional argument)

release notes
    Optional notes appended to changelog and tag message

-p, --push
    Push tag and changelog branch to remote origin

-d, --dry-run
    Preview changes without tagging or pushing

-e, --edit
    Edit changelog and tag message in editor before finalizing

-c, --commit-changelog
    Commit the updated CHANGELOG.md

-s, --sign
    GPG-sign the release tag

-f, --force
    Force overwrite existing tag

--preview
    Preview changelog without bumping version

--skip-changelog
    Skip changelog generation

--push-repo=<URL>
    Push to specific remote repository

--ci
    CI mode: auto-detect bump type from commit message

DESCRIPTION

git release is a utility from the git-extras package that simplifies creating releases in Git repositories following semantic versioning (SemVer). It bumps the version number based on the specified type (major, minor, patch, prerelease, or hotfix), generates a changelog by parsing commit messages (assuming conventional commits like feat:, fix:), creates an annotated tag, and optionally commits the changelog, pushes the tag, and more.

The command detects the current version from the latest tag matching SemVer pattern (e.g., v1.2.3). It supports editing the changelog before tagging and dry-run previews. Ideal for CI/CD pipelines or teams using conventional commits, it reduces manual steps for consistent releases.

Requires git-extras installed; works best with projects maintaining a CHANGELOG.md file.

CAVEATS

Requires git-extras package; assumes SemVer tags and conventional commits for changelog. May conflict if non-standard commit formats used. Not part of core Git.

INSTALLATION

Linux: sudo apt install git-extras or sudo dnf install git-extras.
macOS: brew install git-extras.
From source: git clone https://github.com/tj/git-extras && cd git-extras && make install

EXAMPLE

git release minor
Generates changelog, bumps to next minor version (e.g., v1.2.3 → v1.3.0), tags, commits changelog.

git release patch -p -e
Bumps patch, edits changelog, pushes tag.

HISTORY

Part of git-extras project started by Mark Lee in 2012. git release added around 2013 to support SemVer workflows. Evolved with options for CI integration; actively maintained on GitHub.

SEE ALSO

Copied to clipboard