# Code repositories/Version control

**Code Repositories**

A code repository, or repo, is a storage location for software source code and related files. It is often used in conjunction with version control systems to manage and track changes to the code over time. Repositories can be local (on a developer's machine) or hosted on a server (often in the cloud). They facilitate collaboration among developers, allowing multiple people to work on different parts of a project without conflicting with each other's changes.

**Version Control Systems (VCS)**

Version Control Systems are software tools that help manage changes to source code over time. They keep track of every modification made to the code in a special kind of database. If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members.

#### Key Features of Version Control Systems:

1. **Committing Changes:** Saving changes to the version control repository.
2. **Branching and Merging:** Creating branches for new features or experiments and merging them back into the main codebase after completion.
3. **History and Tracking:** Keeping a detailed history of who made which changes and when, which is essential for understanding the evolution of a project.
4. **Collaboration:** Facilitating collaborative work even on the same files, with mechanisms to manage conflicts.
5. **Reverting and Rollback:** Allowing for the reversion to previous versions if new changes introduce errors.

#### Most Common/Popular Version Control Systems and Repositories:

1. **Git**
   * **Description:** A distributed version control system. It’s the most widely used VCS in the world.
   * **Common Repositories:** GitHub, GitLab, Bitbucket.
2. **Subversion (SVN)**
   * **Description:** A centralized version control system, it allows users to keep track of changes made to files and directories over time.
   * **Repository Example:** Apache Subversion.
3. **Mercurial**
   * **Description:** Similar to Git, it’s a distributed version control system, focused on ease of use and high performance.
   * **Repository Example:** Often used with web-based repositories like Bitbucket.
4. **GitHub**
   * **Description:** Not just a repository but also provides additional features like issue tracking, GitHub Actions for CI/CD, and more. It uses Git for version control.
   * **Platform:** Web-based, with a desktop client available.
5. **GitLab**
   * **Description:** Similar to GitHub but offers more integrated CI/CD features. It also uses Git.
   * **Platform:** Web-based, with self-hosted options.
6. **Bitbucket**
   * **Description:** Offers both Git and Mercurial as VCS options. It integrates well with JIRA, a project management tool, and Trello.
   * **Platform:** Web-based.

#### Choosing a VCS/Repository

The choice of a version control system and repository often depends on the specific needs of a project, the scale of the operation, and personal or team preferences. For example, Git is preferred for its flexibility and widespread adoption, making it a standard choice for many open-source and commercial projects.
