What is Git?
Git is a free, open-source version control software. It was created by Linus Torvalds in 2005. This tool is a version control system that was initially developed to work with several developers on the Linux kernel.
This basically means that Git is a content tracker. So Git can be used to store content and it is mostly used to store code because of the other features it provides.
Real-life projects generally have multiple developers working in parallel. So they need a version control system like Git to make sure that there are no code conflicts between them.
Also, the requirements in such projects change often. So a version control system allows developers to revert and go back to an older version of their code.
The branch system in Git allows developers to work individually on a task (For example One branch -> One task OR One branch -> One developer). Basically think of Git as a small software application that controls your codebase, if you’re a developer.
If we want to start using Git, we need to know where to host our repositories.
A repository (or “Repo” for short) is a project that contains multiple files. In our case, a repository will contain code-based files.
There are two ways you can host your repositories. One is online (on the cloud) and the second is offline (self-installed on your server).
There are three popular Git hosting services: GitHub (owned by Microsoft), GitLab (owned by GitLab), and BitBucket. We’ll use GitHub as our hosting service.
Before using Git we should know why we need it
Git makes it easy to contribute to open source projects
Nearly every open-source project uses GitHub to manage its projects. Using GitHub is free if your project is open source, and it includes a wiki and issue tracker that makes it easy to include more in-depth documentation and get feedback about your project.
If you want to contribute, you just fork (get a copy of) a project, make your changes, and then send the project a pull request using GitHub’s web interface. This pull request is your way of telling the project you’re ready for them to review your changes.
By using GitHub, you make it easier to get excellent documentation. Their help section and guides have articles for nearly any topic related to Git that you can think of.
GitHub can integrate with common platforms such as Amazon and Google Cloud, with services such as Code Climate to track your feedback, and can highlight syntax in over 200 different programming languages.
Track changes in your code across versions
When multiple people collaborate on a project, it’s hard to keep track of revisions who changed what, when, and where those files are stored.
GitHub takes care of this problem by keeping track of all the changes that have been pushed to the repository.
Much like using Microsoft Word or Google Drive, you can have a version history of your code so that previous versions are not lost with every iteration. It’s easy to come back to the previous version and contribute your work.