Monorepo Version Tags Conventions

后端 未结 1 1893
时光取名叫无心
时光取名叫无心 2021-02-13 15:34

Is there a standard for using version tags in monorepos? Is something along the lines of 1.0.0-myapp1, and 2.1.0-myapp2 acceptable? Or is there anoth

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-13 15:43

    tags are organized in directories and files (all git references are, run tree .git/refs/tags to see that), so I would suggest naming the tags :

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

    This will group versions for each app together, and some commands will treat the numbers "naturally" :

    # 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
    

    If you want to avoid the "tags for myapp2" showing up when you inspect the log for myapp1, you may use --decorate-refs= :

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

    If you need this on a regular basis, you can add an alias for it :

    $ git config alias.logmyapp1 log --decorate-...
    

    0 讨论(0)
提交回复
热议问题