Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git References and Branch Tips: Commits Are Objects, Branches Are Names

Build a disposable repository with at least two commits. Record the object IDs that `main` resolves to. Create a second branch without switching, prove that both branch names resolve to the same commit, and prove that the working tree is still on the original branch. Then advance the second branch with one real commit. Record both branch tips and show that only the second branch moved. Finally, compare the repository's object-ID/type inventory immediately before and after creating a branch and explain why the result demonstrates a reference change rather than commit creation. Do not use a mock Git implementation. Success requires evidence about references and objects, not only command exit codes. Capture the full ref name, the commit IDs before and after each branch movement, the current branch name, and the object inventory comparison. The key conclusion should be stated in Git's own terms: branch refs move; commit objects are identified by object names and are not duplicated merely because another ref points at them.

Intermediate ~6 min read

Challenge 1

Complete the Git command to resolve or verify a revision.

bash Your answer
git  --symbolic-full-name main

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to resolve or verify a revision.

bash Your answer
git  --verify main^{commit}

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to resolve or verify a revision.

bash Your answer
git  --verify experiment^{commit}

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to resolve or verify a revision.

bash Your answer
git  HEAD

Press Ctrl⌘Enter to check your answer