Bird
Raised Fist0
Gitdevops~20 mins

Git LFS for large files - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Git LFS Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Git LFS track command effect
What is the output or effect after running git lfs track "*.psd" in a Git repository?
Git
git lfs track "*.psd"
ARemoves all .psd files from the repository history
BDisables Git LFS tracking for .psd files
CImmediately uploads all existing .psd files to the remote Git LFS server
DAdds an entry to .gitattributes file to track all .psd files with Git LFS
Attempts:
2 left
💡 Hint
Think about what the track command does to file patterns in Git LFS.
❓ Troubleshoot
intermediate
1:30remaining
Git LFS push error diagnosis
You run git push origin main after adding large files tracked by Git LFS, but get an error: batch request: This repository is over its data quota. What is the most likely cause?
AYou have exceeded the storage or bandwidth limits of your Git LFS hosting service
BThe remote repository URL is incorrect
CYou forgot to run <code>git lfs install</code> before pushing
DYour Git LFS client is outdated and cannot push files
Attempts:
2 left
💡 Hint
Consider what 'over its data quota' means in hosting services.
❓ Configuration
advanced
2:00remaining
Configuring Git LFS for a new repository
Which sequence of commands correctly sets up Git LFS tracking for all .zip files and commits the configuration?
A
git lfs install
git lfs track "*.zip"
git add .gitattributes
git commit -m "Track zip files with Git LFS"
B
git lfs track "*.zip"
git add .gitattributes
git commit -m "Track zip files with Git LFS"
git lfs install
C
git add .gitattributes
git lfs install
git lfs track "*.zip"
git commit -m "Track zip files with Git LFS"
D
git lfs install
git add .gitattributes
git lfs track "*.zip"
git commit -m "Track zip files with Git LFS"
Attempts:
2 left
💡 Hint
Remember the order: install Git LFS first, then track, then add and commit.
✅ Best Practice
advanced
1:30remaining
Best practice for storing large files in Git
Which practice is best when working with large binary files in a Git repository?
ACommit large binary files directly to the Git repository without Git LFS
BUse Git LFS to store large binary files outside the main Git history
CCompress large files manually and commit the compressed versions without Git LFS
DStore large files in a separate branch within the same repository
Attempts:
2 left
💡 Hint
Think about how Git handles large files and history size.
🔀 Workflow
expert
2:00remaining
Git LFS file retrieval after clone
After cloning a repository that uses Git LFS, what happens when you run git checkout main?
AGit LFS disables itself and large files remain as pointers in the working directory
BGit checkout fails because large files are missing and must be downloaded manually
CGit LFS downloads the actual large files referenced by pointers automatically during checkout
DGit replaces large files with empty placeholders and requires manual download commands
Attempts:
2 left
💡 Hint
Consider how Git LFS integrates with Git commands after cloning.

Practice

(1/5)
1. What is the main purpose of Git LFS (Large File Storage)?
easy
A. To convert large files into text files for easier diffing
B. To speed up Git commit operations by compressing files
C. To automatically merge large files during conflicts
D. To store large files outside the main Git repository history

Solution

  1. Step 1: Understand Git LFS functionality

    Git LFS stores large files outside the main Git history to keep the repository lightweight.
  2. Step 2: Compare options with Git LFS purpose

    Options A, B, and C describe unrelated features; only To store large files outside the main Git repository history matches Git LFS's main goal.
  3. Final Answer:

    To store large files outside the main Git repository history -> Option D
  4. Quick Check:

    Git LFS purpose = store large files externally [OK]
Hint: Git LFS stores big files outside Git history [OK]
Common Mistakes:
  • Thinking Git LFS compresses files inside Git
  • Assuming Git LFS merges conflicts automatically
  • Believing Git LFS converts files to text
2. Which command correctly tracks all .psd files using Git LFS?
easy
A. git track lfs *.psd
B. git lfs track "*.psd"
C. git lfs add *.psd
D. git add lfs *.psd

Solution

  1. Step 1: Recall Git LFS tracking syntax

    The correct command to track files is git lfs track "pattern".
  2. Step 2: Check each option's syntax

    Only git lfs track "*.psd" uses the correct command and pattern syntax. Others are invalid commands.
  3. Final Answer:

    git lfs track "*.psd" -> Option B
  4. Quick Check:

    Correct Git LFS track syntax = git lfs track [OK]
Hint: Use 'git lfs track "*.ext"' to track file types [OK]
Common Mistakes:
  • Swapping command order like 'git track lfs'
  • Using 'git lfs add' instead of 'track'
  • Trying to add files directly with 'git add lfs'
3. After running git lfs track "*.mp4" and committing, what will happen when you add a new video.mp4 file and push?
medium
A. The video.mp4 file is stored in Git LFS and pushed separately
B. The video.mp4 file is pushed as a normal Git blob
C. Git will reject the push because video.mp4 is too large
D. The video.mp4 file is ignored and not pushed

Solution

  1. Step 1: Understand effect of tracking and committing .gitattributes

    Tracking '*.mp4' and committing .gitattributes tells Git to use LFS for .mp4 files.
  2. Step 2: Add and push a new .mp4 file

    Git LFS stores the file outside Git history and pushes it separately, so The video.mp4 file is stored in Git LFS and pushed separately is correct.
  3. Final Answer:

    The video.mp4 file is stored in Git LFS and pushed separately -> Option A
  4. Quick Check:

    Tracked files use LFS storage on push [OK]
Hint: Tracked files go to LFS storage on push [OK]
Common Mistakes:
  • Assuming large files push normally without LFS
  • Thinking Git rejects large files automatically
  • Believing tracked files are ignored
4. You ran git lfs track "*.zip" but forgot to commit .gitattributes. What problem will occur?
medium
A. Git LFS will track .zip files but not push them
B. Git will refuse to add .zip files locally
C. Git LFS will not track .zip files on other clones
D. No problem; tracking works without committing .gitattributes

Solution

  1. Step 1: Understand role of .gitattributes in Git LFS

    .gitattributes stores tracking rules and must be committed to share them.
  2. Step 2: Effect of not committing .gitattributes

    Other clones won't know to track .zip files with LFS, so Git LFS will not track .zip files on other clones is correct.
  3. Final Answer:

    Git LFS will not track .zip files on other clones -> Option C
  4. Quick Check:

    Commit .gitattributes to share LFS tracking [OK]
Hint: Always commit .gitattributes after tracking files [OK]
Common Mistakes:
  • Assuming local tracking affects other clones
  • Thinking Git blocks adding files without .gitattributes
  • Believing tracking works without committing
5. You want to track both .psd and .mp4 files with Git LFS. Which sequence correctly sets this up and shares it with your team?
hard
A. Run git lfs track "*.psd" and git lfs track "*.mp4", then commit and push .gitattributes
B. Run git lfs track "*.psd *.mp4" and push without committing
C. Add files with git add *.psd *.mp4 then run git lfs install
D. Run git lfs track "*.psd" only, then manually add .mp4 files

Solution

  1. Step 1: Track each file type separately

    Git LFS requires separate track commands for each pattern, so run both track commands.
  2. Step 2: Commit and push .gitattributes to share tracking

    Committing and pushing .gitattributes shares tracking rules with the team.
  3. Final Answer:

    Run git lfs track "*.psd" and git lfs track "*.mp4", then commit and push .gitattributes -> Option A
  4. Quick Check:

    Track each pattern + commit .gitattributes [OK]
Hint: Track each pattern separately and commit .gitattributes [OK]
Common Mistakes:
  • Trying to track multiple patterns in one command incorrectly
  • Forgetting to commit .gitattributes
  • Running git lfs install after adding files
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard