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.


Navigation

Wiki

Other

QR Code
QR Code git:tips (generated for current page)