0
0
Gitdevops~20 mins

Packfiles and compression in Git - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Packfiles and Compression Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Understanding git packfile creation
What is the output of the command git gc --aggressive --prune=now in a repository with many loose objects?
AIt deletes all objects and resets the repository to an empty state.
BIt compresses loose objects into packfiles and removes unreachable objects immediately.
CIt creates packfiles but does not remove any loose objects.
DIt only removes unreachable objects but does not create packfiles.
Attempts:
2 left
💡 Hint
Think about what aggressive garbage collection does in Git.
🧠 Conceptual
intermediate
1:30remaining
Purpose of delta compression in Git packfiles
Why does Git use delta compression inside packfiles?
ATo encrypt objects for security during transfer.
BTo create backups of objects in case of corruption.
CTo speed up network transfer by sending full copies of objects.
DTo store only the differences between similar objects, reducing disk space usage.
Attempts:
2 left
💡 Hint
Think about how storing differences can save space.
Troubleshoot
advanced
2:00remaining
Diagnosing corrupted packfile error
You run git fsck and get an error about a corrupted packfile. Which command helps you safely rebuild packfiles to fix this?
Agit reset --hard HEAD
Bgit clean -f -d
Cgit repack -a -d --window=50 --depth=50
Dgit checkout -- .
Attempts:
2 left
💡 Hint
Look for a command that repacks objects.
Best Practice
advanced
1:30remaining
Optimizing packfile compression for large repositories
Which approach is best to optimize packfile compression for a large repository with many similar files?
AUse <code>git gc --aggressive</code> periodically to maximize compression.
BAvoid using packfiles and keep all objects loose for faster access.
CDisable delta compression to speed up packfile creation.
DManually delete packfiles to reduce disk usage.
Attempts:
2 left
💡 Hint
Aggressive garbage collection improves compression but takes more time.
🔀 Workflow
expert
2:30remaining
Sequence to safely reduce repository size using packfiles
What is the correct sequence of commands to safely reduce a Git repository size by compressing objects and removing unreachable data?
A3,1,2,4
B1,2,3,4
C2,1,3,4
D3,2,1,4
Attempts:
2 left
💡 Hint
Think about garbage collection first, then repacking, pruning, and finally checking.