Russell Steicke <russellsteicke@xxxxxxxxx> writes: > Ah yes, I forgot about those files. I _think_ (but I'm not certain > without digging into the code) that it's always safe to rm > packed-refs, as that file is a cache for quicker access to the refs. No what you think is incorrect, no it is not safe at all, and no it is not a cache. refs are created loose as files under $GIT_DIR/refs/. When pack-refs is run (either from the toplevel or as part of gc), these loose ref files are removed and instead written to $GIT_DIR/packed-refs file. When a new ref is created or an existing ref is updated, only $GIT_DIR/refs/ is modified. When reading or enumerating, a loose ref, if found, is used. Otherwise a record in packed-refs is consulted. The consequences are: - If you have $GIT_DIR/refs/heads/master and at the same time, an entry for refs/heads/master exists in $GIT_DIR/packed-refs, removing the entry in packed-refs happens to be safe, because it was already masked. - If you do not have $GIT_DIR/refs/heads/old, but an entry for refs/heads/old exists in $GIT_DIR/packed-refs, removing the entry in packed-refs means you lose the "old" branch. You don't want to do that. - When deleting a ref, we remove it from $GIT_DIR/refs/, but at the same time, if packed-refs contains an entry for it, we remove it from there. Otherwise, the removal of the loose one will unmask the stale entry in packed-refs file. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html