Git Commands You Should Know Part-1

Git Commands You Should Know Part-1

Let’s dive in and get a better understanding of CVCS, DVCS, git, and git commands 😎

Git is a distributed version control system that helps developers to collaborate on projects of any scale.

Linus Torvalds created it in 2005 to develop Linux Kernel.🌟

What is a Distributed Version Control System?🤔

To understand the DVCS let’s first learn the Centralized Version Control

Centralized Version Control

Centralized version control systems are based on the idea that there is a single “central” copy of your project somewhere (probably on a server), and the developers will “commit” their changes to this central copy.

“Committing” a change simply means recording the change in the central system. Other developers can then see this change. They can also pull down the change, and the version control tool will automatically update the contents of any files that were changed.

Some of the most common centralized version control systems you may have heard of or used are CVS, Subversion (or SVN), and Perforce.

Centralized Version Control-atul_kuamr_singh

Centralized Version Control-atul_kuamr_singh

The repository in the above diagram indicates a central server that could be local or remote which is directly connected to each of the developer’s workstations.

Developers can update and commit their changes directly to the repository.

Drawbacks

  • Since everything is centralized, any case of the central server getting crashed or being corrupted will result in losing the entire data of the project.

  • CVCS is slower compared to DVCS, you always need to be connected to a network to perform any action.

Distributed Version Control System

A distributed version control system is a system that helps you keep track of changes you’ve made to files in your project. This change history lives on your local machine and lets you revert to a previous version of your project with ease in case something goes wrong.

In DVCS, every developer has a local copy or “clone” of the main repository i.e. everyone maintains a local repository of their own which contains all the files and metadata present in the main repository.

Distributed_Version_Control_System_atul_kumar_singh

Distributed_Version_Control_System_atul_kumar_singh

As you can see in the above diagram, every developer maintains a local repository on its own, which is actually the copy or clone of the central repository on their hard drive. They can commit and update their local repository without any interference.

They can update their local repositories with new data from the central server by an operation called “pull” and affect changes to the main repository by an operation called “push” from their local repository.

Advantages Of Centralized Version Control

  • Performing actions other than pushing and pulling change sets is extremely fast because the tool only needs to access the hard drive, not a remote server.

  • Committing new change sets can be done locally without anyone else seeing them. Once you have a group of change sets ready, you can push all of them at once.

  • Since every contributor has a full copy of the project repository, they can share changes with one another to get feedback before affecting changes in the main repository.

  • If the central server crashes, the lost data can be easily recovered from any of the contributor’s local repositories.


Thanks a lot for reading till the end 🙏 If you liked the article, please give likes and share it with your others.

Email: atul19251@gmail.com

Web: https://iamatul.netlify.app/

Did you find this article valuable?

Support Dev Station by becoming a sponsor. Any amount is appreciated!