What is Git?
Git is a free and open-source, distributed version control system.
It is designed to handle small to very large projects with speed and efficiency.
It is used to collaborate on code.
It helps us to track code changes in our project
For more details, please visit here.
Why should we use Git?
Suppose, you are working on a project which has many files in it. Now, you need some help from your friends and want to share the files with them. So, you have to copy all the files and send those to them and wait until they finish their work. You can’t add new things in the meantime as they might be changing the files differently. So, it is a hectic process.
It helps to control the versions of our projects and also save the changes in the cloud. So, you can just share the link of the repository (in simple terms, a project folder) and have as many friends as possible working on your project. You can also track their changes and so can they.
It helps us to resolve if there is any conflict and keep everyone updated on who is working on that project.
Not only for sharing, but Git also helps us to store all the versions of our project. It is very hectic to go back to any previous state of a project manually. So, it helps us to store the major states of our app. So that we can get back to that state whenever we want.
What are the various areas in Git?
There are mainly three areas in Git. They are –
Working Directory: It is the place where we write our code, modify it, or add or delete files.
Staging Area: It is the area where we keep our files which are in a stable state and ready to be published. Basically, after reviewing our code we place them in the Staging Area.
Repository (.git directory): It is the place where the version controlling of our project takes place. In simple terms, in this place, it saves a permanent snapshot of our project. We send the files which were in the staging area to the Repository by committing.
Features of Git?
When the content of a file is changed or a new file is added or an old file is deleted, it is called Modified.
You can select the files from the Modified state to Stage.
Only Staged files can be Committed (which means saving a permanent snapshot of the code) with a suitable message.
You can commit multiple times and revert back to any of the previous commits.
It does not store a separate copy of every file in every commit. It keeps track of the changes made.
What is GitHub?
I thought that Git and GitHub is the same. But actually, it’s not.
It is a company that makes tools that uses Git.
Since 2018, Microsoft owns the company and it has become the largest host of source code in the world.