Git and GitHub Explained like I’m five!
On my journey to becoming a developer, one of the most challenging things to understand has been Git. As a developer, you might be required to make constant changes to your code which lead to releasing new versions.
Git is a version control system that helps us manage the changes made to our code or programs and stores them in repositories; so we can easily changes made over time. For instance, imagine you are writing an essay. While writing this essay, you’re creating duplicates, making changes and saving them with different names to keep track of which version each one is, so you can go back to it when you need to. That’s the whole idea behind version control.
This system allows people to work in groups easily. With git, a team of developers can have their own versions of a project on their computer and later, the team can merge these individual versions into the main version of project.
A lot of times and for different reasons, people confuse Git and GitHub. For me, I think it was the name and how they connect. So..
What is GitHub?
Github is a cloud-based platform where developers host their code for version control and collaboration. It allows you manage git repositories online, work and network with other developers.
This makes it clearer that Git and Github are two different things. To be specific, here are the differences;
- Git works locally on your computer while Github is a hosted on the web.
- Git is a version control system. Github is a hosting service for Git repositories.
- Git is a command line tool while Github is a Graphical User Interface.
How to set up Git
Installing git on your computer
With git being a command line tool, we can access it through our computer terminals. Although, you have to make sure that you have git installed on your computer.
To download git, go to https://git-scm.com/downloads.
Download the git version for your system and follow through with installation process. After installation, go to you computer terminal and run the command;
If it was well installed, it would return the version of git you have installed on your computer.
However, if you use a Mac or Linux Operating System, you can use the default bash terminal that is pre-installed on your computer.
On Windows OS, you can use the inbuilt PowerShell terminal or Git Bash terminal that comes with the Git installation package.
Configure Your Name and Email
Once you’re finished with the installation process, the next step is to set up a name and email that Git can identify you with. In your computer’s terminal, run the following commands:
git config --global user.name "Enter your name"
git config --global user.email "Enter your email"
To check if you have set this up correctly, run this command:
git config user.name #this shows your name
git config user.email # this shows your email
Why is Git important?
To conclude this article, here’s a list of reasons why git is important and every developer should understand it:
- It helps you maintain the backup of your source code.
- Git gives room for effective collaboration with other developers and teams.
- It allows you to sail new features efficiently.
- It also makes it easier to deploy source code on server.