What is Git?
(Global Information Tracker). Git is a version control system that allows you to version your code and your files. Git maintained the history of the changes in the filesystem.
With Git, you can keep a record of who made changes in the file and you can revert to earlier versions of the file if needed. Git also makes it easy to collaborate with others, as you can share changes and merge the changes made by different people into a single version of a file.
Git is a distributed version control system (VCS) that helps developers manage and track changes in their source code during software development.
Let’s take a real-time scenario, If the Developer created the Java code @ 20th of this month & made some changes in the code @ 23rd of deleted the few lines, @ 24th added some lines in the code & @ 25th removed the lines from the code. So, the filesystem only shows the created and modified timestamps for that date. filesystem didn’t track middle activity like deleting or removing the line from the existing code. Every time a developer can’t make a copy of the modified code and keeps it in a different location that is not a standard practice and here GIT comes into the picture. That gives you whenever your code was modified, deleted and created everything every timestamp git does for you that’s why every programmer should know about git.
I will also try to elaborate in simple terms below:
Filesystem | VCS (GIT) |
If we want to create a file in Linux we can use touch to create the file (touch amit.txt) | In VCS we can create Repo through Git init command and repo has been created. |
It shows timestamps like the creation of the filesystem, Owner, and Time. | We can put the same file in the VCS amit.txt |
But if we can do the rm command and that file rm amit.txt the file has been deleted and we cannot restore it. | So, the file previously in the filesystem was untracked and once we put it in the git it’s been tracked. |
Here is the Limitations of working with the filesystem. | In VCS we have everything as informed above Author's name & who has edited and modified the file, creation of the versioning of the file. It is also called commit hash. |
If we can do rm amit.txt we should not worry about that because we have having version for that file which is kept and we can restore it. Usually, VCS allows Versioning and restoring. |
What is Version Control? How many types of version controls do we have?
Version control systems are a category of software tools that help in recording changes made to files by keeping track of modifications done in the code.
There are two types of Version Control System:
Centralized Version Control System:
Only one server is there in a centralized server system this is less popular. There are many drawbacks like we can not do versioning over the internet, it’s having only one centralized & also What if the hard disk of the central database becomes corrupted, and proper backups haven’t been kept? You lose absolutely everything. For example: SVN
Distributed Version Control System:
Files are multiple computers distributed and from there we can version our file, over the internet we can manage and version our code with DVCS. It’s a popular version control system. 99%
It integrates the work that is done simultaneously by different members of the team. In some rare cases, when conflicting edits are made by two people to the same line of a file, human assistance is requested by the version control system in deciding what should be done.
Version control provides access to the historical versions of a project. This is insurance against computer crashes or data loss. If any mistake is made, you can easily roll back to a previous version. It is also possible to undo specific edits that too without losing the work done in the meantime. It can be easily known when, why, and by whom any part of a file was edited.
For Example: Git and GitHub.
What is GitHub?
GitHub is a web-based platform that provides hosting for version control using Git. It is a subsidiary of Microsoft, and it offers all of the distributed version control and source code management (SCM) functionality of Git as well as adding its features. GitHub is a very popular platform for developers to share and collaborate on projects, and it is also used for hosting open-source projects.
Thank You!!
Happy Learning !!