Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git pack-refs: Pack References for Efficient Storage

Create a disposable repository with at least two commits, three branches, and three tags. Inspect `.git/refs` before packing. Run `git pack-refs --all`, then prove that the branch and tag names still resolve even though their loose files have been removed. Create or update a branch and observe that an active branch can become loose again. Run `git pack-refs --all --no-prune` and explain what remains on disk. In a fresh disposable repository, use `--include 'refs/heads/feature/*'` to pack only feature branches, then use `--all --exclude 'refs/heads/feature/*'` and explain why an exclusion does not unpack refs that were already packed. Finally run `git pack-refs --auto` and explain why its behavior is policy-driven. Finish by explaining why `git pack-refs` and `git repack` must not be treated as interchangeable storage operations. This lesson uses only official Git project documentation for command semantics: `git-pack-refs`, the Git 2.56.0 command index, and the official ref-storage documentation referenced by those manuals. No third-party Git documentation is used for command semantics.

Advanced ~6 min read

Challenge 1

Complete the Git command to pack loose refs.

bash Your answer
git  --all

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to pack loose refs.

bash Your answer
git  --all --no-prune

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to pack loose refs.

bash Your answer
git  --auto

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to pack loose refs.

bash Your answer
git 

Press Ctrl⌘Enter to check your answer