Is git gc running git repack?

I turned off git's annoying auto-repacking feature (I think most git sites know the message “repacking for optimal performance” when working with git) and instead call “git gc” overnight with a crown.

However, I'm not sure if this is enough, and should I also run git repack before or after git gc.

The "git repack" and "git gc" files do not mention any connection between them, and the "git repack" man page actually contains this phrase:

Instead, free inaccessible objects will be clipped according to normal expiration rules with the next git gc call.

This would mean that “git gc” is not sufficient for all housing retention tasks, as well as “git repack”. Is this correct, and which utility commands should be used for git?

+4
source share
1 answer

git repack just repackaging objects.

git gc repackages them and discards old unreachable objects.

To make sure that you can do something like find .git/objectsbefore and after git gc: before you see all the new objects as separate files. Subsequently, there should be only one large package file.

For more information, you can also see the code: The builtin / gc.c repack team prepared and executed .

+6

Source: https://habr.com/ru/post/1541932/


All Articles