0
0
Gitdevops~5 mins

How branches are just files with hashes in Git - Quick Revision & Summary

Choose your learning style9 modes available
Recall & Review
beginner
What is a Git branch in simple terms?
A Git branch is just a file that stores the hash (a unique ID) of the latest commit on that branch.
Click to reveal answer
beginner
How does Git know which commit a branch points to?
Git reads the branch file which contains the hash of the commit it points to. This hash tells Git the exact snapshot of the project.
Click to reveal answer
intermediate
What happens to the branch file when you make a new commit?
The branch file updates to store the new commit's hash, so the branch always points to the latest commit.
Click to reveal answer
intermediate
Where are branch files stored in a Git repository?
Branch files are stored inside the .git/refs/heads directory as simple text files containing commit hashes.
Click to reveal answer
beginner
Why is it useful to think of branches as files with hashes?
Because it shows branches are lightweight pointers to commits, making Git fast and efficient at switching and managing code versions.
Click to reveal answer
What does a Git branch file contain?
AThe list of all commits in the branch
BThe full source code of the project
CThe commit message of the last commit
DThe hash of the latest commit on that branch
Where can you find branch files inside a Git repository?
A.git/objects/
B.git/config
C.git/refs/heads/
D.git/hooks/
What happens to a branch file when you commit new changes?
AIt updates to the new commit's hash
BIt deletes the old commit
CIt creates a new branch file
DIt stores the commit message
Why are branches considered lightweight in Git?
ABecause they are stored in the cloud
BBecause they are just files with commit hashes
CBecause they contain all commit messages
DBecause they store full copies of the project
What does the commit hash in a branch file represent?
AA unique ID for a specific project snapshot
BThe name of the branch
CThe date of the last commit
DThe author of the commit
Explain how Git branches work as files with hashes.
Think about how a branch points to a commit using a simple file.
You got /4 concepts.
    Describe where branch files are stored and what they contain in a Git repository.
    Look inside the .git folder to find branch files.
    You got /3 concepts.