30 quizzes
Inspect the contents of a Git object when you know its SHA-1 hash
git cat-file -p Click an option to fill the blank:
Manually create a blob from file contents and write it to the object database
echo "Hello, Git!" | git hash-object -w -t Click an option to fill the blank:
List the entries of the tree object referenced by the latest commit
git ls-tree ^{tree}Click an option to fill the blank:
View detailed information about a commit object, including its tree and parents
git show Click an option to fill the blank:
Create a lightweight tag that points at the current commit
git tag Click an option to fill the blank:
Which Git object type directly stores file contents without filenames or permissions?
What does a tree object primarily represent in Git?
Where are branch reference files like main typically stored?
What is the role of packfiles in Git?
Which statement about reflog is correct?
Order the steps to inspect the blob contents backing a committed file using Git internals only.
Drag and drop to reorder, or use the arrows.
Order the steps to manually create a tree from the index and then commit it.
Drag and drop to reorder, or use the arrows.
Order the steps to recover a lost commit after an accidental hard reset.
Drag and drop to reorder, or use the arrows.
Order the steps to inspect the contents of a packfile that was just created.
Drag and drop to reorder, or use the arrows.
HEAD currently points to commit abcdef1. What will this command print?
1git rev-parse HEADThe branch main points to commit 1234567. What will this command print?
1git rev-parse refs/heads/mainYou are currently on branch feature-login. What will this command output?
1git symbolic-ref --short HEADThe HEAD reflog entry HEAD@{0} is currently at commit 9999aaa. What will this print?
1git rev-parse HEAD@{0}Identify the incorrect command in this workflow for creating a commit object from a tree.
Click on the line(s) that contain the bug.
git write-treeparent_sha=$(git rev-parse HEAD)git commit-tree $(git write-tree) -m "Manual commit" -p parent_shagit update-ref refs/heads/main $(git rev-parse HEAD)Find the mistake in this attempt to inspect a blob from the index.
Click on the line(s) that contain the bug.
git add README.mdblob_sha=$(git ls-files -s README.md | cut -d' ' -f2)git cat-file -p blob_shaFind the incorrect command in this attempt to recover a lost branch using reflog.
Click on the line(s) that contain the bug.
git refloglost_sha=$(git reflog show HEAD@{1} -n 1)git branch recovered lost_shagit checkout recoveredMatch each Git reference concept with its description.
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Match Git internals commands with what they primarily inspect.
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Match reflog and recovery-related commands with their purposes.
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Complete the commands to inspect the latest commit’s tree and then view a specific blob.
git ls-tree git cat-file -p Click an option to fill blank 1:
Complete the commands to repack objects and inspect the resulting packfile.
git repack git verify-pack Click an option to fill blank 1:
Complete the commands to configure how long reflog entries are kept globally.
git config --global "60.days"git config --global "30.days"Click an option to fill blank 1:
Select the line that shows the directory where loose and packed objects are stored.
Click on the line to select.
.git/ config HEAD objects/ refs/ hooks/Select the line that shows the current HEAD commit hash from the reflog.
Click on the line to select.
1a2b3c4 HEAD@{2}: checkout: moving from feature to main5d6e7f8 HEAD@{1}: commit: Add logging9a0b1c2 HEAD@{0}: reset: moving to 5d6e7f8Select the line that represents a tree object entry for a subdirectory.
Click on the line to select.
100644 blob a1b2c3d4e5f6g7h8i9j0 README.md040000 tree 1111222233334444555566667777888899990000 src100644 blob abcd1234abcd1234abcd1234abcd1234abcd1234 main.py