GIT - 2.3 Repository
In Git, the set of version-controlled files and their full history is what we call a repository. It is tempting to picture a repository as the collection of files and folders that make up your project, but in reality the repository is not so much the files themselves — it is the history of those files over time, every change recorded since the project began.
Where the repository actually lives
In a typical project folder, the repository data sits inside a hidden subfolder called .git. That folder contains its own collection of files and subdirectories that constitute the internal structure of the repository. Git uses them to store every commit, branch, tag, configuration entry and tracked object.
You can think of the relationship like this:
- The visible project folder is your working directory — where you edit code.
- The hidden
.gitfolder inside it is the repository — where Git keeps the full history.
Strong recommendation: stay out of the .git folder unless you know exactly what you are doing. Its contents are managed internally by Git, and editing them by hand can corrupt the entire history.
Because the repository contains the complete history of every tracked file, it is best practice to keep each repository as focused as possible. For example, a typical application can have one repository for the frontend and another for the backend. Each project — each independent unit of code that evolves on its own timeline — should live in its own repository, and ideally should not be shared with unrelated applications. This makes the history cleaner, clones faster, and access control much easier to manage as the team grows.
Summary
A Git repository is fundamentally a history of your project's files and versions, not merely a collection of files and folders. The hidden .git folder contains the entire internal structure and historical data. Best practice is to keep repositories focused and dedicated to single applications, with separate repositories for frontend and backend components.
Key points
- A repository stores the complete version history of all project files, not just the current snapshot
- The .git folder is the repository's internal database containing all metadata and history
- Keep repositories as targeted as possible—avoid mixing multiple applications in a single repository
- Large applications should use separate repositories for different components (e.g., frontend vs. backend)
- Repositories should not be shared across unrelated projects or applications
FAQ
What is the difference between a repository and a folder of files?
A repository is more than a collection of files—it is a complete history of all versions and changes to those files. The .git folder stores this entire history, metadata, and version control information.
Why should I keep my repository focused?
Keeping repositories targeted and focused makes version control more manageable, improves performance, and prevents unrelated projects from interfering with each other's history and collaboration workflows.
Should frontend and backend code share the same repository?
No—best practice is to maintain separate repositories for frontend and backend components, allowing independent version control, deployment cycles, and team workflows.