0
0
Gitdevops~5 mins

Garbage collection with git gc - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the git gc command?

git gc stands for garbage collection. It cleans up unnecessary files and optimizes the local repository to save space and improve performance.

Click to reveal answer
intermediate
Which files does git gc typically remove or compress?

It removes unreachable objects (like old commits no longer referenced) and compresses loose objects into pack files to reduce disk space.

Click to reveal answer
intermediate
When does Git automatically run garbage collection?

Git runs garbage collection automatically after a certain number of changes or when the repository reaches a size threshold.

Click to reveal answer
beginner
How can you force Git to run garbage collection manually?

By running the command git gc in your repository folder.

Click to reveal answer
beginner
What is a pack file in Git?

A pack file is a compressed collection of Git objects that saves space and speeds up repository operations.

Click to reveal answer
What does git gc do?
ACreates a new commit
BDeletes all branches
CCleans up and optimizes the repository
DClones a repository
Which of these is NOT a result of running git gc?
ADeleting the entire repository
BRemoving unreachable objects
CCompressing loose objects
DCreating pack files
When does Git automatically run garbage collection?
AAfter every commit
BWhen you push to remote
COnly when you run <code>git gc</code> manually
DWhen repository size or changes reach a threshold
What is a pack file in Git?
AA backup of your repository
BA compressed file storing multiple Git objects
CA branch name
DA commit message
How do you manually trigger garbage collection in Git?
Agit gc
Bgit prune
Cgit clean
Dgit reset
Explain what happens when you run git gc in your repository.
Think about cleaning and organizing your repository files.
You got /3 concepts.
    Describe when and why Git runs garbage collection automatically.
    Git helps keep your repo tidy behind the scenes.
    You got /3 concepts.