Challenge - 5 Problems
Shallow Clone Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Output of shallow clone with depth 1
What is the output of the following command when cloning a large repository with many commits?
Choose the most accurate description of the clone result.
git clone --depth 1 https://github.com/example/repo.gitChoose the most accurate description of the clone result.
Git
git clone --depth 1 https://github.com/example/repo.git
Attempts:
2 left
💡 Hint
Think about what the --depth option limits in a git clone.
✗ Incorrect
Using --depth 1 creates a shallow clone with only the latest commit, reducing download size and time.
🧠 Conceptual
intermediate2:00remaining
Effect of shallow clone on git log
After cloning a repository with
git clone --depth 3, what will git log show compared to a full clone?Attempts:
2 left
💡 Hint
Consider what shallow cloning limits in the commit history.
✗ Incorrect
A shallow clone with depth 3 contains only the latest 3 commits, so git log shows only those.
🔀 Workflow
advanced2:00remaining
Extending a shallow clone depth
You cloned a repository with
git clone --depth 1. Later, you want to fetch more history to depth 5. Which command correctly extends the shallow clone to include the last 5 commits?Attempts:
2 left
💡 Hint
Think about how to fetch more commits after cloning shallowly.
✗ Incorrect
Using
git fetch --depth=5 extends the shallow clone to include the last 5 commits.❓ Troubleshoot
advanced2:00remaining
Error when pushing from a shallow clone
You cloned a repository with
What is the most likely cause?
git clone --depth 1 and made commits locally. When you try to push, you get an error:error: refusing to push because the remote contains work that you do not have locallyWhat is the most likely cause?
Attempts:
2 left
💡 Hint
Consider how shallow clones affect push operations.
✗ Incorrect
Shallow clones have incomplete history, so git refuses to push to avoid overwriting unknown commits.
✅ Best Practice
expert2:00remaining
Choosing shallow clone depth for CI pipelines
In a continuous integration (CI) pipeline, you want to speed up builds by cloning only necessary commits. Which depth value is best practice to balance speed and build correctness?
Attempts:
2 left
💡 Hint
Think about the tradeoff between speed and completeness in CI.
✗ Incorrect
Depth 50 often provides enough history for build tools while keeping clone time reasonable.