What is a repository in Git?
A repository in Git is a project storage where Git keeps the source code, change history, branches, and service data.
In simpler terms, a repository is a project folder that Git tracks.
What is in a repository:
- project files (code, configs, resources);
- the history of all changes (commits);
- branches;
- tags;
- the
.gitservice directory (the heart of the repository).
Types of repositories:
- Local repository - stored on your computer.
- Remote repository - located on a server (for collaborative work).
Why a repository is needed:
- to track code changes;
- to work in a team;
- to go back to previous versions;
- to experiment with code safely.
Short answer for an interview:
A repository is the place where Git stores the project and its entire change history.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.