Where does Git store tags? I execute:
$ git tag v0.1.0 v0.10.0 v0.11.0
But the directory .git/refs/tags
is empty. Where does Git store these tags?
Thank you.
Tags are ref's that point to specific points in Git history. Tagging is generally used to capture a point in history that is used for a marked version release (i.e. v1. 0.1). A tag is like a branch that doesn't change.
List Git Tags. When you clone a repository, all the tags associated with the repository will be pulled down.
Listing Your Tags If you want just the entire list of tags, running the command git tag implicitly assumes you want a listing and provides one; the use of -l or --list in this case is optional. If, however, you're supplying a wildcard pattern to match tag names, the use of -l or --list is mandatory.
They can also be stored in .git/packed-refs
While wnoise is correct when he stated that Git also stores tags in .git/packed-refs
following a git gc
operation, between "pack" points (meaning, between git gc
operations), Git creates unpacked commit objects and unpacked tags:
derek@derek-OptiPlex-960:~/Projects/test$ git tag 1 2 3 derek@derek-OptiPlex-960:~/Projects/test$ cat .git/packed-refs # pack-refs with: peeled 55a87ab06897aca29285e58beb4e0de15af409fa refs/heads/master 89a6b171ee6d56bc3ce5a4cbd92c6a379594d974 refs/tags/1 55a87ab06897aca29285e58beb4e0de15af409fa refs/tags/2 derek@derek-OptiPlex-960:~/Projects/test$ ls .git/refs/tags 3 derek@derek-OptiPlex-960:~/Projects/test$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With