#git-repository #semver #git #command-line-tool #tool #git-version

app vergit

根据 SemVer 规范递增 git 仓库标签的命令行工具

14 个版本

0.2.12 2023年1月31日
0.2.11 2023年1月31日
0.2.10 2021年6月27日
0.2.9 2021年4月3日
0.1.2 2021年4月1日

#git-version 中排名 18

MIT 许可协议

16KB
237 行代码(不含注释)

vergit

vergit 是一个命令行工具,用于快速递增和推送 git 仓库中的语义版本化标签。它被创建出来是为了减轻在使用严格版本化的 terraform 模块时的一些痛苦。

安装

假设你已经安装了 cargo,可以通过运行以下命令来安装 vergit:cargo install vergit

用法

vergit-bump 
Takes the most recent tag (according to semantic-versioning ordering) of the
current branch of the repository in the working directory and increases the
<component> of the version tag by one.

For example:
    Running the following command
        $ vergit bump minor --global

    In a repository with the following tags:
        hello-world
        0.0.1-beta.3
        0.3.4
        1.8.5

    Will create a new tag 1.9.0 pointing at HEAD

USAGE:
    vergit bump [FLAGS] [OPTIONS] [component]

ARGS:
    <component>
            Defaults to 'prerelease' if current version contains a prerelease component,
            otherwise it will default to 'patch'. If prerelease is specified, but no 
            prerelease component is found, it will fail.
            
            Bumping prerelease tags only works if the last identifier of the prerelease
            component of the version string is numeric.
            
            For example, the following tags CANNOT be bumped using the prerelease command:
                0.0.1           No prerelease tag found
                0.0.1-beta      Last identifier of the prerelease component is not a number
                0.0.1-alpha1    Last identifier of the prerelease component is not a number
                0.0.1-beta.1.a  Last identifier of the prerelease component is not a number
            
            The following tags CAN be bumped using the prerelease command:
                0.0.1-beta.1    => 0.0.1-beta.2
                0.0.1-alpha.3   => 0.0.1-alpha.4
                0.0.1-test.b.2  => 0.0.1-test.b.3
             [possible values: major, minor, patch, prerelease]

FLAGS:
        --dry-run
            In dry-run mode, no changes will be made to the git repository at all, the
            resulting new tag that would otherwise be created is just printed instead.
            
            For example, in a repository with only the tag 0.0.1 the following command:
                $ vergit bump patch --dry-run
            
            Will yield the following output to stdout:
                0.0.2
            
            But make no modifications to the git repository

        --global
            Instead of walking backwards in the currently checked out history to find a tag 
            to increment, vergit will look at all tags in the entire repository and increment 
            the highest absolute version it can find.

    -h, --help
            Prints help information

        --push
            The newly created tag will be pushed to a remote repository.
            
            The remote to push to can be overridden with --remote and defaults to 'origin'.

    -V, --version
            Prints version information


OPTIONS:
        --path <path>
            Path of the git repository to bump [default: . (current working directory)]

        --remote <remote>
            Set the remote to push to [default: origin]

依赖

~11MB
~274K SLoC