Version Control
Version control systems are tools that manage changes to text files. These tools keep track of every change and who made it. If a developer needs to revert to an older version of a file, it can be done with minimal disruption to the workflow or other team members. Version control systems are also an important tool for collaboration among developers.
The benefits of the version control systems include the ability to:
- Keep a long-term history of every file.
- Branch and merge a project.
- Trace each change made to a project.
Centralized Version Control
In a centralized version control systems the main repository is stored on the sever with every version of the code. Using this system every user commits directly to the main repository on the server and gets an update from the main server.
Centralized version control systems are good for small teams where users can communicate easily. We can set centralized version control to lock the files that are checked out by one user to avoid conflicts.
Distributed Version Control
One main difference between Git and the other popular version control systems that came before it is that Git uses distributed version control. Systems like CVS and SVN require a central repository that all users must stay in sync with to use the system effectively. Git is not like that.
Git does not require a central repository because all users will maintain their own repositories. This is accomplished because Git keeps track of changesets or commits instead of versions. These changesets can be easily exchanged between Git repositories.
However, it is common practice when using Git to have a "main" branch and/or repository hosted on a remote server like GitHub. We will cover working with remote repositories later on.