Monorepo 版本标签约定

问题描述 投票:0回答:1

在 monorepos 中是否有使用版本标签的标准?

1.0.0-myapp1
2.1.0-myapp2
这样的东西可以接受吗?还是有另一种方法来区分应用程序之间的版本?

git git-tag gitversion
1个回答
48
投票

tags
组织在目录和文件中(所有 git 引用都是,运行
tree .git/refs/tags
可以看到),所以我建议命名标签:

myapp1/1.0.0
myapp1/1.0.1
 ...
myapp2/2.1.0
myapp2/2.2.0
 ...

这会将每个应用程序的版本组合在一起,一些命令会“自然地”处理数字:

# list tags, sorted by version number :
$ git tag --list --sort="version:refname"
myapp1/1.0.2
myapp1/1.0.10
myapp1/2.0.0
myapp1/10.0.0
myapp2/1.0.0
myapp2/2.0.0
myapp2/11.0.0

如果你想避免在检查 myapp1 的日志时出现“myapp2 的标签”,你可以使用

git log
--decorate-refs=<pattern>
选项:

# this will include tags starting with 'myapp1', and all branches :
$ git log --oneline --graph --decorate-refs=refs/tags/myapp1 --decorate-refs=refs/heads

如果你经常需要这个,你可以为它添加一个别名:

$ git config alias.logmyapp1 log --decorate-...
© www.soinside.com 2019 - 2024. All rights reserved.