Monorepo Version Tags Conventions

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 git log with the --decorate-refs=<pattern> option:

# 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-...

Leave a Comment