git gc --aggressive --prune=now in a repository with many loose objects?The git gc --aggressive --prune=now command compresses loose objects into packfiles and immediately removes unreachable objects, cleaning up the repository efficiently.
Delta compression stores only the changes between similar objects, which reduces the size of packfiles and saves disk space.
git fsck and get an error about a corrupted packfile. Which command helps you safely rebuild packfiles to fix this?git repack rebuilds packfiles and can fix corruption by repacking all objects with specified options.
Running git gc --aggressive compresses objects more thoroughly, which is ideal for large repositories with many similar files.
First run git gc to clean and compress, then git repack -a -d to repack all objects, followed by git prune to remove unreachable objects, and finally git fsck to verify integrity.
