Got it. About renaming old files first to temp files first: I guess that while this long running gc works the repo should be accessible and consistent. If I would rename the old packs to temp files then they would vanish for other git processes leaving a repo which is not consistent (not all referenced objs can be found). I guess it's better to write into temp files and rename them to valid files in the end. After renaming we could delete uneeded pack files.