Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does Git store tags?

Tags:

git

tags

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.

like image 551
0xAX Avatar asked Mar 31 '11 17:03

0xAX


People also ask

How do tags work in git?

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.

Does git clone get all tags?

List Git Tags. When you clone a repository, all the tags associated with the repository will be pulled down.

Which command is used to list the available tags in git?

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.


2 Answers

They can also be stored in .git/packed-refs

like image 168
wnoise Avatar answered Oct 12 '22 14:10

wnoise


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$ 
like image 25
Derek Mahar Avatar answered Oct 12 '22 13:10

Derek Mahar