Where does Git store tags?

后端 未结 2 1128
孤独总比滥情好
孤独总比滥情好 2021-02-06 23:53

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 s

相关标签:
2条回答
  • 2021-02-07 00:26

    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$
    
    0 讨论(0)
  • They can also be stored in .git/packed-refs

    0 讨论(0)
提交回复
热议问题