Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git index-pack: Build and Verify Pack Indexes

Create a disposable repository with at least three commits and run `git repack -ad`. Locate its `.pack` file. Copy that pack outside the repository, remove the copied `.idx` and `.rev` files if present, and use `git index-pack -o` to build a new index. Repeat with `--rev-index` and prove that the `.rev` file is created. Then use `--strict` on the repository's pack. Finally send the pack through `--stdin` into a separate output pack with `--keep`, inspect the resulting `.keep`, `.idx`, and `.rev` files, and explain why `git index-pack` is not a replacement for `git repack` or `git verify-pack`. Do not modify or delete objects in the original repository. Command semantics in this lesson use only the official Git project documentation for `git-index-pack` and the Git 2.56.0 command index. No third-party Git documentation is used.

Advanced ~6 min read

Challenge 1

Complete the Git command to build or inspect a pack index.

bash Your answer
git  -o

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to build or inspect a pack index.

bash Your answer
git 

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to build or inspect a pack index.

bash Your answer
git  .git/objects/pack/pack-<id>.pack

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to build or inspect a pack index.

bash Your answer
git  --rev-index .git/objects/pack/pack-<id>.pack

Press Ctrl⌘Enter to check your answer