What is the purpose of the .git directory in a Git project?
The .git directory stores all the information Git needs to track changes, history, branches, and configuration for the project. It is the heart of the Git repository.
Click to reveal answer
beginner
What does the HEAD file inside the .git directory represent?
The HEAD file points to the current branch or commit that your working directory is based on. It tells Git what you are currently working on.
Click to reveal answer
intermediate
What is stored in the objects folder inside the .git directory?
The objects folder contains all the content Git tracks, saved as compressed files. These include commits, trees (folders), and blobs (file contents).
Click to reveal answer
intermediate
What is the role of the refs directory inside .git?
The refs directory holds references to commit objects, such as branches and tags. It helps Git know where branches and tags point in the commit history.
Click to reveal answer
beginner
What kind of information is stored in the config file inside the .git directory?
The config file stores repository-specific settings like remote URLs, user info, and other Git options that affect how Git behaves in this project.
Click to reveal answer
Which folder inside .git contains the actual data of commits and files?
Ahooks
Brefs
Cobjects
Dlogs
✗ Incorrect
The objects folder stores all the data Git tracks, including commits and file contents.
What does the HEAD file inside .git point to?
AThe current branch or commit
BThe remote repository URL
CThe list of ignored files
DThe commit logs
✗ Incorrect
HEAD points to the current branch or commit you are working on.
Where does Git store branch and tag references?
Arefs
Bobjects
Chooks
Dinfo
✗ Incorrect
The refs directory holds references to branches and tags.
Which file inside .git contains repository-specific settings?
Adescription
Bconfig
Cindex
DHEAD
✗ Incorrect
The config file stores settings like remote URLs and user info.
What is the main purpose of the .git directory?
ATo store project source code
BTo store user documents
CTo store temporary files for the OS
DTo store all Git data and metadata for the repository
✗ Incorrect
The .git directory contains all data and metadata Git needs to manage the repository.
Explain the main components inside the .git directory and their roles.
Think about what Git needs to track commits, branches, and settings.
You got /4 concepts.
Describe how Git uses the HEAD file and why it is important.
Consider what happens when you switch branches or make commits.
You got /3 concepts.
Practice
(1/5)
1. What is the main purpose of the .git directory in a Git project?
easy
A. It stores all the data and history of the Git repository.
B. It contains the source code files of the project.
C. It holds temporary files created by the operating system.
D. It stores user configuration settings unrelated to Git.
Solution
Step 1: Understand the role of .git directory
The .git directory is created when you initialize a Git repository and it stores all Git-related data.
Step 2: Differentiate from other directories
Source code files are outside .git, and temporary or unrelated user files are not stored here.
Final Answer:
It stores all the data and history of the Git repository. -> Option A
Quick Check:
.git = Git data storage [OK]
Hint: Remember: .git holds Git's data, not project files [OK]
Common Mistakes:
Confusing .git with project source files
Thinking it stores temporary OS files
Assuming it holds unrelated user configs
2. Which of the following is a correct folder inside the .git directory?
easy
A. src
B. temp
C. bin
D. objects
Solution
Step 1: Recall standard .git folders
The .git directory contains folders like objects, refs, and hooks.
Step 2: Identify the correct folder
Among the options, only objects is a valid folder inside .git.
Final Answer:
objects -> Option D
Quick Check:
objects folder exists in .git [OK]
Hint: Look for Git-specific folders like objects [OK]
Common Mistakes:
Choosing project folders like src
Selecting unrelated folders like bin or temp
3. If you look inside the .git/refs/heads folder, what will you typically find?
medium
A. Configuration settings for Git hooks
B. Binary objects of the project files
C. Files representing branches in the repository
D. Temporary files created during commits
Solution
Step 1: Understand refs/heads purpose
The refs/heads folder stores files named after branches, each containing the commit hash of the branch tip.
Step 2: Differentiate from other folders
Binary objects are in objects, hooks configs are in hooks, and temporary files are not stored here.
Final Answer:
Files representing branches in the repository -> Option C
4. You accidentally deleted the .git/HEAD file. What problem will this cause?
medium
A. Your project files will be deleted.
B. Git will lose track of the current branch or commit.
C. Git will stop tracking remote repositories.
D. Nothing will happen; Git recreates it automatically.
Solution
Step 1: Understand the role of HEAD file
The HEAD file points to the current branch or commit checked out in the working directory.
Step 2: Consequence of deleting HEAD
Without HEAD, Git cannot know which branch or commit is active, causing errors in commands.
Final Answer:
Git will lose track of the current branch or commit. -> Option B
Quick Check:
HEAD tracks current branch [OK]
Hint: HEAD file = current branch pointer; deleting it breaks Git [OK]
Common Mistakes:
Thinking project files get deleted
Assuming remote tracking is affected
Believing Git auto-recreates HEAD always
5. You want to manually inspect the commit history by reading files inside the .git directory. Which folder should you explore to find the actual commit objects?
hard
A. objects
B. hooks
C. refs
D. logs
Solution
Step 1: Identify where commit data is stored
The objects folder stores all Git objects including commits, trees, and blobs in compressed form.
Step 2: Differentiate from other folders
refs holds pointers to commits, hooks contains scripts, and logs track changes to refs.
Final Answer:
objects -> Option A
Quick Check:
Commit data = objects folder [OK]
Hint: Commit objects live in objects folder inside .git [OK]
Common Mistakes:
Confusing refs with actual commit data
Looking in hooks or logs for commits
Assuming commit data is in project files
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.