What is Git and Version control system?
GIT is a version control system used by millions of developers it helps you keep track of all the files in a project get tracks every change you make if you make a mistake it can reset a file to match a previous version or you can reset the version of all the project files at the same time the collection of all versions of your project files is known as a git repository.
it’s basically a folder in which you add it your files then run git commands to store your changes and pull in changes from other contributors you can have multiple git repositories on your computer one for each project you’re working on git is used by teams of developers working on a project together
it lets them share changes each person makes and combine those changes to create a finished project.
What is a version control system?
let’s look at the problems that we encounter when you don’t use the version control system.
So let’s say you have a computer and you’re writing code on that computer so the code files are saved locally on that computer’s hard disk but what if your hard disk crashes or your computer has some kind of problem in that case whatever code you have written is lost.
The second problem is if multiple people want to contribute to that code then they cannot do it if it is on one computer even if it is let’s say these two people have their own computers and if they want to work on the same code how to do that they have to transfer files using a pen drive from one computer to another and they have to do Coleman’s manually which is quite cumbersome.
The third problem you have is there is no tracking of versions so let’s say you have your code it is working fine and you are making one more enhancement or you are fixing some bugs so you made some changes and let’s say it doesn’t look good so you want to go to a previous good version of your code but there is no way
if you have your port on your computer because the simple file system doesn’t give you a version tracking so you have all these different issues especially when you are working on a bigger codebase or a sample project you will encounter this issues again and again.
Version Control system
Version control systems solve all these problems let’s look at all these problems one by one and see how VCS or the control system solves these issues.
The first problem was hard disk failure in the version control system the code is saved on the cloud. cloud is basically some remote machine which is much more stable than your local computer and
it is guaranteed that you will never lose your core from the cloud so you store your code on the cloud and then you sync the files to your local computer that way if you have Hardware problem or some computer breakdown you can always get your core back from the cloud so problem number one fixed problem.
Number two multiple people contributing to the same codebase again you have your golden copy of your 4 on the cloud so that these two people can work on their individual computers and then whenever they’re ready are to push the changes they will push it to a cloud.
now let’s say if they are working on the same function let’s say here there is a function python function left some and if there they both are making changes to the same function then there are more tools available which can help you resolve the conflict so merging is pretty easy these two people can work on their own without worrying about anything so it’s very beautiful how a VCS solves these issues or of collaboration.
Problem no this 3 was version tracking in the version control system or you have all of your changes tracked down through different versions of the same file so let’s say you have this file called food or py which has some a function calls some and let’s say right now the function looks like this it just returns a plus B but if you make some changes later on and if you save it it will be saved as version. number 2 I was number 3 and so on at any given point of time, you feel like I want to go back to the previous old version which was working okay you can do it very easily.
Now there are different version control systems available in the market for example git mercurial subversion etc.
but git is by far the best version control system I will tell you two reasons number one is it is a distributed version control system where the version history is maintained on your local computer as well as it is maintained on the cloud so let’s say you are in some area where you don’t have an internet connection you still have an ability to try to track the versions are and whenever you have interconnected internet connection you can sync it up with your remote which is your copy in the cloud the second biggest benefit of using git is Github the most popular website to host goal is powered by git.
Follow us on Instagram: Pure_coders
More Articles: Click