What is the main purpose of the objects directory inside the .git folder?
Think about where Git saves the actual data snapshots.
The objects directory stores all Git objects like commits, trees, and blobs in a compressed form. This is where the actual content and history are saved.
Assuming a Git repository has branches named main, feature1, and bugfix, what will be the output of the command ls .git/refs/heads/?
The refs/heads directory stores branch references.
The .git/refs/heads/ directory contains files named after each branch. Listing it shows the branch names.
You cloned a repository but the .git/HEAD file is missing. What problem will this cause?
The HEAD file points to the current branch or commit.
The HEAD file tells Git which branch or commit is currently active. Without it, Git cannot track the current working state.
What happens if you delete the .git/index file in a Git repository?
The index file stores the staging area snapshot.
The .git/index file holds the staging area data. Deleting it removes staged changes, so you must stage files again.
Which method ensures a complete backup of a Git repository including all branches, tags, and history?
Think about what contains the full repository data and history.
The .git directory contains all repository data including commits, branches, tags, and configuration. Copying it ensures a full backup.