Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git Reflog: Reading the Local History of References

Create a disposable repository with three commits on `main`. Create a feature branch and switch between the branches so the HEAD reflog records checkouts. Then switch back to main, move `main` backward with `git reset --hard HEAD~1`, and inspect both the branch reflog and HEAD reflog. Resolve `main@{1}` and prove that it names the pre-reset commit. Do not recover or delete anything yet; the next lesson owns recovery workflows.

Advanced ~6 min read

Challenge 1

Complete the Git command to inspect reference history.

bash Your answer
git  HEAD -6

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to inspect reference history.

bash Your answer
git  main -6

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to inspect reference history.

bash Your answer
git  list

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to inspect reference history.

bash Your answer
git  exists refs/heads/main

Press Ctrl⌘Enter to check your answer