This is an old revision of the document!
Keep Data in .git/refs
Git keeps references to heads (branches) and tags in .git/refs. This is very convenient because you can obtain the SHA1 ID of any tag just by doing cat .git/refs/tags/<tag_name>.
But this mechanism only works if you do not run git gc. The garbage collector packs tags by default, that means the files from .git/refs/tags will be removed and their SHA1 IDs will be stored in file .git/packed-refs instead.
To prevent this you can use the following in your .git/config:
[gc] packrefs = 0
See man git-pack-refs
for more details.
Avoiding Tag Collisions
If you fetch tags from multiple remote repositories, it may happen that they will generate conflicts because all tags are stored in .git/refs/tags directory. This will happen, for example, if you fetch objects from both the sip-router git repository and also the repository at http://git.sip-router.org/ser. The reason is that both of them originate from a single cvs repository and thus they contain tags with identical names. To avoid this situation you can do the following in your .git/config:
[remote "sr"] .... fetch = refs/tags/*:refs/tags/sr/* tagopt = --no-tags [remote "cvs"] .... fetch = refs/tags/*:refs/tags/cvs/* tagopt = --no-tags
The configuration above will fetch all tags from both repositories explicitly and will store them in subdirectories under .git/refs/tags to avoid conflicts in file names. Because you download tags explicitly you can tell git-fetch not to download any tags using the tagopt option.