Version Control System (VCS)
A Version Control System (VCS) is a software tool that helps in recording and tracking changes made to files by different developers. It's about keeping a detailed account of every modification made to the code, ensuring that these changes are both trackable and reversible.
Types of VCS: Centralized Version Control System (CVCS) and Distributed Version Control System (DVCS)
Centralized Version Control System (CVCS)
In CVCS, there is a server and a client. The server holds a single central copy of the project along with a history of changes made to the code base over a period of time. The basic workflow involves getting the latest version of the code from a central repository, making your own changes in the code, and then committing or merging those changes into the central repository. Examples of CVCS include Subversion (SVN) and Concurrent Version System (CVS).
Distributed Version Control System (DVCS)
In DVCS, every single developer or client has their own server and they will have a copy of the entire history or version of the code and all of its branches in their local server or machine. You can work locally and disconnected, which is more convenient than centralized source control. Examples of DVCS include Git, Mercurial, and Bazaar.
What is Git?
Git is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers who are collaboratively developing source code during software development.
Git thinks of its data more like a series of snapshots of a miniature filesystem. With Git, every time you commit, or save the state of your project, Git basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot.
Why Git should be used over others?
Git offers several advantages over other VCS:
- Performance: Git provides the best performance when it comes to version control systems.
- Security: Git handles your security with cryptographic method SHA-1.
- Branching Model: Git has a different branching model than the other VCS.
- Staging Area: Git has an intermediate stage called "index" or "staging area" where commits can be formatted and modified before completing the commit.
- Distributed Development: Git allows every user to have the most up-to-date version of the project. Work can be done offline, which in turn means it can be done anywhere.
- Pull Requests: Git allows developers to initiate discussions around their work before integrating it with the rest of the codebase.