Compare tags uses the branch instead


I am facing an odd behaviour when comparing two tags on Github (both via APIs and UI).
If I am to compare tags for which there exists a branch with the same name, Github uses the last commit of the branch instead of the tagged commit.

As example returns 2758 commits of difference. Tag 6.7 is associated with sha 5d031d9. shows that sha
5d031d9 is only about 20 commits from tag 6.7-RC1.

This odd behaviour is also confirmed by the url. When comparing tag 6.7-RC1 and tag 6.7 or branch 6.7, the url is the same.

Is this the expected behaviour? I would expect it to behave differently if I am comparing the branch or the tag against another tag.

Any workaround to obtain the desired behavior? (Comparing tag 6.7-RC1 and tag 6.7? Maybe using the commit sha and what command?)

Thanks in advance

A possible solution is to compare the commits instead:

I am still curious whether this is the reported one is the expected behaviour.

Hello, thanks for reaching out.

Yes, this is the expected behavior. Unfortunately, when you have a branch and a tag that are named identically, GitHub has to guess which one you mean and picks the branch by default. If you want your comparisons to be unambiguous, you’ll need to use different naming schemes for branches and tags or use the commit hash specifically to perform the comparison.

I hope that helps!