Version Control System
A version control system (VCS) is a tool that records the changes of files over time. You can call back a specific version later. It is also called source control or revision control.
Think about a normal project folder without version control. You have files like report.doc, report-final.doc, report-final-2.doc and report-final-really-final.doc. After some days nobody knows which one is the correct file. A VCS solves this problem.
What a version control system gives you
- A full history of every file, with who changed it and why.
- Ability to go back to any older version.
- Ability to compare two versions and see the exact lines changed.
- Safe teamwork, because changes of different people can be merged.
- A backup, when the repository is stored on a server.
Types of version control systems
1. Local version control
The oldest way. Versions are stored in a simple database on your own computer (for example RCS). It is good for one person, but there is no way to work with other people.
2. Centralized version control
There is one central server which has all the versions, and people take files from that server (for example Subversion, also called SVN, and CVS). The big problem is the single point of failure. If the server goes down, nobody can save work, and if its disk is damaged, the full history can be lost.
3. Distributed version control
Every person has a full copy of the repository with all the history (for example Git and Mercurial). If a server dies, any copy can be used to restore it. Most commands are also very fast, because they work on your own computer.
| Type | Example | Where is the history? | Works offline? |
|---|---|---|---|
| Local | RCS | Only on your computer | Yes |
| Centralized | SVN, CVS | On one central server | No, mostly |
| Distributed | Git, Mercurial | On every computer and on the server | Yes |
Important words
- Repository (repo): a project folder with its full history. Git keeps it in a hidden
.gitfolder. - Commit: a saved snapshot of your project at one moment, with a message.
- Branch: a separate line of work.
- Remote: a copy of the repository on another computer or server, like GitHub.
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |