git - 使用 GIT 进行软件版本编号

标签 git versioning git-tag

概述:我想在 Git 中设置自动(或至少半自动)软件版本编号。

我想为我的项目设置一些起始版本号(例如 v1.0)。我知道,出于这个原因,有 tag 。谷歌了一下,发现了一堆 Material 。例如:

git - the simple guide博客说:

You can create a new tag named 1.0.0 by executing git tag 1.0.0 1b2e1d63ff the 1b2e1d63ff stands for the first 10 characters of the commit id you want to reference with your tag.

Kudelabs说:

$ git tag -a 'milestone1' -m 'starting work for milestone 1, due in 2 weeks'
$ git push --tags

我真的很困惑。第一种方法和第二种方法有什么区别:git taggit tag -a。无法弄清楚使用哪个来达到此目的。

如何在裸远程存储库中设置版本号,我对其进行了 5-6 次提交和推送?

最佳答案

git describe 默认情况下使用带注释的标签。因此,为了遵循约定,请按照 Kudelabs 的说法创建带注释的 (-a)。

关于git - 使用 GIT 进行软件版本编号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12332060/

相关文章:

git - 我如何查看我的 git 远程 url?

windows - Vim fugitive 插件无法识别 Windows 上的 git archive

Git 克隆 : index-pack died of signal 25

spring-mvc - Spring MVC 中的 Controller 继承和带有 URL 版本控制的模糊映射

Git:如何使现有的 git 轻量级标签指向另一个提交?

git - TortoiseGit 1.8 不要求凭据

maven - 用于 fork 的 Maven 项目的版本标签是什么?

Maven : Multimodule projects and versioning

Azure DevOps API : get latest action on the repository

git - 如何列出所有的 Git 标签?