Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git show-ref: Inspect Local References

Create a disposable repository with two branches, one lightweight tag, and one annotated tag. Use `git show-ref` to produce: (1) the complete ref listing, (2) branches only, (3) tags only, (4) exact verification of one branch, (5) an existence test for an existing and a missing ref, (6) an annotated-tag dereference, (7) hash-only output, and (8) an `--exclude-existing` filter fed by standard input. Record the exit status of the existence and verification checks. Then run `git pack-refs --all` and repeat the inspection to demonstrate that logical refs remain visible even when their loose files have been packed. Do not manually read `.git/packed-refs` as a substitute for the command's output.

Advanced ~6 min read

Challenge 1

Complete the Git command to list or verify refs.

bash Your answer
git 

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to list or verify refs.

bash Your answer
git  --heads

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to list or verify refs.

bash Your answer
git  --tags

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to list or verify refs.

bash Your answer
git  --verify refs/heads/main

Press Ctrl⌘Enter to check your answer