Repository
A storage location for software packages or source code, including the complete history of changes, metadata, and configuration files.
Detailed Explanation
A repository (repo) is where your project's code and its entire version history are stored. Local repositories live on your machine. Remote repositories (GitHub, GitLab, Bitbucket) live in the cloud and serve as the central source of truth for teams.
Repositories contain the source code, Git history (all commits, branches, and tags), configuration files (.gitignore, package.json), documentation (README), and CI/CD configuration. Choosing the right repository structure and naming convention is important for discoverability and organization, especially in monorepo setups where multiple projects share a single repository.
Why It Matters
Repositories are the fundamental unit of code organization. Understanding how to structure, name, and manage repositories is essential for effective development.
Real-World Example
A company has a monorepo containing the web app, mobile app, shared libraries, and infrastructure code. Each component lives in its own directory with its own dependencies but shares a single Git history.
When to Use
Every code project should live in a repository. Choose between single repos per project (polyrepo) or multiple projects in one repo (monorepo) based on team structure and coupling.
Advantages
- Complete version history preserved
- Enables collaboration across teams
- Supports multiple workflows (branching, forking)
- Integrates with CI/CD and deployment tools
- Provides a single source of truth
Disadvantages
- Monorepos can become slow at scale
- Polyrepos create dependency management challenges
- Repository structure decisions are hard to change later
- Large repositories require special handling (Git LFS)
- Access control can be complex in large organizations
Related Terms
Frequently Asked Questions
What is a monorepo?
A monorepo is a single repository containing multiple projects that share code and history. Examples include Google's and Facebook's codebases. Tools like Nx, Turborepo, and pnpm workspaces help manage monorepos.
How should I name my repository?
Use lowercase, hyphens for separation, and descriptive names. Examples: my-saas-app, react-component-library, api-gateway. Avoid generic names and special characters.
Should I make my repository public or private?
Open-source projects are public. Proprietary code should be private. Consider making internal tools public if they could benefit the community. Private repos are free on most platforms now.
What is a .gitignore file?
A .gitignore file tells Git which files and directories to ignore. Common entries include node_modules/, .env, build output, and OS-specific files. Always set up .gitignore before making your first commit.
How do I contribute to someone else's repository?
Fork the repository to your account, create a branch, make changes, and open a pull request to the original repository. This is the standard open-source contribution workflow.