Git Product home page Git Product logo

bump's Introduction

bump

GitHub release (latest SemVer) bump

Command-line to bump version in a git repository

Install

Get it from the Snap Store

$ snap install bump
$ brew install guilhem/homebrew-tap/bump
$ go get github.com/guilhem/bump

Usage

Help

$ bump --help
Bump version

Usage:
  bump [command]

Available Commands:
  help        Help about any command
  major       Bump major version
  minor       Bump minor
  patch       Bump patch

Flags:
      --allow-dirty     allow usage of bump on dirty git
      --dry-run         Don't touch git repository
  -h, --help            help for bump
      --latest-tag      use latest tag, prompt tags if false (default true)
  -t, --toggle          Help message for toggle

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

Major

$ git tag
1.1.1
$ bump major
$ git tag
1.1.1
2.0.0

Minor

$ git tag 
v1.1.1
$ bump minor
$ git tag
v1.1.1
v1.2.0

Patch

$ git tag
1.1.1
$ bump patch
$ git tag
1.1.1
1.1.2

bump's People

Contributors

dependabot[bot] avatar guilhem avatar oliverevans96 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bump's Issues

Index out of Range error when repository has a single tag

Hello, I reinstalled the error through go instead of snap (Docs need updating from go get to go download x@y and encountered the following error

# Only one tag is present
$ git tag
v1.0.0

# Attempt to bump it 
$ bump minor
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/guilhem/bump/pkg/semver.Latest({0x0, 0x0, 0x2?})
	/home/user/go/pkg/mod/github.com/guilhem/[email protected]/pkg/semver/semver.go:60 +0xc5
github.com/guilhem/bump/cmd.preRun(0xdaa0a0, {0x9ac392?, 0x0?, 0x0?})
	/home/user/go/pkg/mod/github.com/guilhem/[email protected]/cmd/root.go:116 +0x2ac
github.com/spf13/cobra.(*Command).execute(0xdaa0a0, {0xde14a0, 0x0, 0x0})
	/home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:835 +0x58b
github.com/spf13/cobra.(*Command).ExecuteC(0xdaa5a0)
	/home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
	/home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	/home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:895
github.com/guilhem/bump/cmd.Execute()
	/home/user/go/pkg/mod/github.com/guilhem/[email protected]/cmd/root.go:63 +0x230
main.main()
	/home/user/go/pkg/mod/github.com/guilhem/[email protected]/main.go:21 +0x17
	
# Add a second tag
$ git tag v2.0.0-rc.1

# View both tags
$ git tag
v1.0.0
v2.0.0-rc.1

# Successful bump
$ bump minor
INFO[0000] tag choosed                                   current tag=v2.0.0-rc.1 tags="[\"v2.0.0-rc.1\"]"
INFO[0000] values                                        Current Tag=v2.0.0-rc.1 New  Tag=v2.1.0 logger="bump minor"

Cannot bump patch past 1

If my tag is 0.20.0, bump patch will bump it to 0.20.1.

However, if I try running it again, bump patch returns this:

0.20.1
2021/03/02 10:43:19 fail to create tag: tag already exists

error="is dirty" when git working tree is clean

Installed via brew:

~/Dev/cloud-extension-yii2 1.x
❯ bump patch
ERRO[0005] test dirty                                    error="is dirty"
Error: is dirty
ERRO[0005] ExecuteContext                                error="is dirty"

~/Dev/cloud-extension-yii2 1.x 5s
❯ git st
On branch 1.x
Your branch is up to date with 'origin/1.x'.

nothing to commit, working tree clean

panic: runtime error: index out of range [0] with length 0

$ bump minor --allow-dirty
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/guilhem/bump/pkg/semver.Latest({0x0, 0x0, 0x2?})
 /home/halkeye/go/pkg/mod/github.com/guilhem/[email protected]/pkg/semver/semver.go:60 +0x186
github.com/guilhem/bump/cmd.preRun(0xe47760, {0x9def6e?, 0x4?, 0x9def72?})
 /home/halkeye/go/pkg/mod/github.com/guilhem/[email protected]/cmd/root.go:116 +0x29d
github.com/spf13/cobra.(*Command).execute(0xe47760, {0xc000119a30, 0x1, 0x1})
 /home/halkeye/go/pkg/mod/github.com/spf13/[email protected]/command.go:835 +0x5c3
github.com/spf13/cobra.(*Command).ExecuteC(0xe47c60)
 /home/halkeye/go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x38d
github.com/spf13/cobra.(*Command).Execute(...)
 /home/halkeye/go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/spf13/cobra.(*Command).ExecuteContext(...)
 /home/halkeye/go/pkg/mod/github.com/spf13/[email protected]/command.go:895
github.com/guilhem/bump/cmd.Execute()
 /home/halkeye/go/pkg/mod/github.com/guilhem/[email protected]/cmd/root.go:63 +0x1f8
main.main()
 /home/halkeye/go/pkg/mod/github.com/guilhem/[email protected]/main.go:21 +0xf

I think its having trouble with grabbing tags?

$  bump minor --allow-dirty --latest-tag=false
Use the arrow keys to navigate: ↓ ↑ → ←
? Select Previous tag:

No results

Though there are tags

$  git tag
v0.1.0
v0.2.0

Snap Install Permission Issues

When I install via Snap (v0.2) the program throws permission issues trying to bump a repository

Example:

$ git tag
v1.0.0

$ bump minor
ERRO[0000] git new                                       error="can't open git: open .../.git/packed-refs: permission denied"

$ ls -la .git/packed-refs
-rw-rw-r-- 1 user user 1725 Jul  7 16:16 .git/packed-refs

$ chmod 777 .git/packed-refs 

$ .git/packed-refs
-rwxrwxrwx 1 user user 1725 Jul  7 16:16 .git/packed-refs

$ bump minor
ERRO[0000] git new                                       error="can't open git: open .../.git/packed-refs: permission denied"

Using chmod -R on the entire git directory with 777 perms did not resolve the issue, and the user was correct across all files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.