After looking at Git tags and seeing how they are propagated and how many workarounds there are to pruning them, I concluded that the best fix would be to change the structure of refs/remotes/origin/
. So, why are refs under refs/remotes/origin/
assumed to be branches? It would have been easy to replicate the top-level structure under the remote ref too:
refs/remotes/origin/heads/ <-- remote tracking branches
refs/remotes/origin/tags/ <-- remote tracking tags
refs/remotes/origin/notes/ <-- remote tracking notes
But all tools that work with Git assume that refs under refs/remotes/origin/
are branches.
Is there an actual reason this is the way things are or is it merely an accident?
Edit 1:
After looking into this a little more I found that git log --decorate
will correctly show annotated tags under the refs/remotes/origin/tags/*
but lightweight tags show up as branches.
Config file:
[remote "origin"]
url = ssh://git@github.com/test/example.git
fetch = +refs/heads/*:refs/remotes/origin/heads/*
fetch = +refs/tags/*:refs/remotes/origin/tags/*
Lightweight tag:
commit e447ca1e2f3c765072c6bd783981619da3d6a090 (tag: v0.2, origin/tags/v0.2)
Author: Joanna Blogs <joanna@blogs.com>
Date: Thu Aug 18 14:38:48 2016 -0500
Testing out a light weight tag
Annotated tag:
commit 334d587e8f9bad1756665384056760c0cb798f32 (tag: v0.1, tag: origin/tags/v0.1)
Author: Joe Blogs <joe@blogs.com>
Date: Fri Jul 1 09:24:25 2016 -0500
Testing an annotated tag
However, as expected, the git tag -l
command doesn't show them at all.