根据最近的标签描述当前提交
git describe 从最近的 tag 推导版本字符串,常用于构建版本号、制品命名和发布脚本。它依赖标签历史,浅克隆或没有 tag 时会退化。
git describe --tags
git describe --tags --always
git describe --tags --dirty
git describe --tags --long
git describe --tags --match 'v*'
git describe --tags --exact-match
git describe --tags --abbrev=12 HEAD
git describe --tags --first-parent
--tags。--always 退回短哈希。--dirty 才会显示后缀,否则版本看起来是干净的。--long 强制输出 tag-距离-g哈希,适合需要精确提交的制品。--match 能过滤 tag 前缀,避免被无关标签干扰。合上页面,先回答,再展开对照。
--tags。--always,退回短哈希。--dirty;只有加上它才会显示未提交改动的后缀。
小程序版
微信扫码,随时查命令