Git LFS (Large File Storage) is an extension for Git that helps manage large files by storing them outside the main repository, replacing them with small pointer files inside Git.
Click to reveal answer
beginner
How does Git LFS store large files differently from regular Git?
Instead of storing the actual large files in the Git repository, Git LFS stores small pointer files in Git and keeps the large files on a separate server or storage.
Click to reveal answer
beginner
Which command initializes Git LFS in a repository?
The command git lfs install sets up Git LFS in your local Git environment.
Click to reveal answer
beginner
How do you track a file type with Git LFS?
Use git lfs track "*.fileextension" to tell Git LFS to manage files with that extension.
Click to reveal answer
intermediate
What happens when you clone a repository that uses Git LFS?
Git LFS downloads the small pointer files first, then automatically fetches the large files from the LFS server after cloning.
Click to reveal answer
What is the main benefit of using Git LFS?
AIt automatically compresses all files in the repository
BIt stores large files outside the Git repository to keep repo size small
CIt speeds up Git commit operations by skipping files
DIt replaces Git for version control
✗ Incorrect
Git LFS keeps large files outside the main Git repo, reducing repository size and improving performance.
Which command do you run to start using Git LFS in your local Git setup?
Agit lfs enable
Bgit lfs init
Cgit lfs start
Dgit lfs install
✗ Incorrect
The correct command to initialize Git LFS is git lfs install.
How do you tell Git LFS to track all PNG image files?
Agit lfs add png
Bgit track lfs png
Cgit lfs track "*.png"
Dgit add *.png
✗ Incorrect
Use git lfs track "*.png" to track PNG files with Git LFS.
What file does Git LFS update to keep track of which files it manages?
A.gitattributes
B.gitignore
CREADME.md
D.gitconfig
✗ Incorrect
Git LFS updates the .gitattributes file to mark files it manages.
When cloning a repo with Git LFS files, what happens to the large files?
AThey are downloaded automatically after cloning
BThey are not downloaded at all
CYou must download them manually from the server
DThey are included in the initial clone like normal files
✗ Incorrect
Git LFS downloads large files automatically after cloning the repo.
Explain how Git LFS helps manage large files in a Git repository.
Think about how Git normally stores files and what changes with Git LFS.
You got /4 concepts.
Describe the steps to start tracking a new file type with Git LFS in your project.
Consider initialization, tracking, and committing changes.
You got /4 concepts.
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
Step 1: Understand Git LFS functionality
Git LFS stores large files outside the main Git history to keep the repository lightweight.
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.
Final Answer:
To store large files outside the main Git repository history -> Option D
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
Step 1: Recall Git LFS tracking syntax
The correct command to track files is git lfs track "pattern".
Step 2: Check each option's syntax
Only git lfs track "*.psd" uses the correct command and pattern syntax. Others are invalid commands.
Final Answer:
git lfs track "*.psd" -> Option B
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
Step 1: Understand effect of tracking and committing .gitattributes
Tracking '*.mp4' and committing .gitattributes tells Git to use LFS for .mp4 files.
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.
Final Answer:
The video.mp4 file is stored in Git LFS and pushed separately -> Option A
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
Step 1: Understand role of .gitattributes in Git LFS
.gitattributes stores tracking rules and must be committed to share them.
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.
Final Answer:
Git LFS will not track .zip files on other clones -> Option C
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
Step 1: Track each file type separately
Git LFS requires separate track commands for each pattern, so run both track commands.
Step 2: Commit and push .gitattributes to share tracking
Committing and pushing .gitattributes shares tracking rules with the team.
Final Answer:
Run git lfs track "*.psd" and git lfs track "*.mp4", then commit and push .gitattributes -> Option A
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 unknownstrongwhile earning +1 Grip toward your certificate.