How to use Git and GitHub — Introduction for Beginners.
September 29,2023 /#GIT
Git and GitHub are common tools used in programming. They help you manage different versions of your code and collaborate with other developers.
Building projects is one of the core parts of being a developer. And Git and GitHub are essential tools you’ll use when building projects with others.
But they can look complicated if you haven’t used them before. So i wrote this article to simply how Git and GitHub work.
Table of Content
- What are Git and GitHub?
- Why should you learn Git and GitHub?
- Differences between Git and GitHub
- How to start using Git and GitHub
- Resources to learn Git and GitHub
What are Git and GitHub?
Git was developed in 2005 by Linus Torvald as open source software for tracking changes in a distributed version control system.
Git is open source because its source code is made freely available for anyone to modify and use, aside from its creator. Open-source project are built and maintained collectively by different developers in different locations.
Git track change via a distributed version control system. This means that Git can track the state of different version of your project while you’re developing them. It is distributed because you can access your code files from another computer-and so can other developers.
But you also need a place to host your code which makes controlling each version of your project easier and faster. This where GitHub comes in.
GitHub is a “Hub” (a place or platform) where Git users build software together. GitHub is also an hosting provider and version control platform you can use to collaborate on open source project and share files. When you’re using GitHub, you’re working with Git beneath the hood.
Why should you learn Git GitHub?
According to Techmonitor.ai, over 73 million developers use GitHub as of November 2021. And the GitHub community is set to hit 100 million user by 2025.
As you can see, million of people all over the world use these tools, and the number just keeping going up.
Because of this, more companies are requiring new hires to know how to use Git GitHub. So if you’re looking for a developer job, these are essential skills to have
If you are not using Git and GitHub, it’s clear you should be!
Differences between Git and GitHub
Git is a version control system that manages and keep track of your code. GitHub, on the other hand, is a service that let you host, share, and manage your code file on the internet.
GitHub uses Git underneath, and lets you manage your Git repositories or folders easily on its platform.
So Git is the actual version control system and GitHub is the platform where you host your code.
If you want to learn more about the difference between these two tools, you can read this tutorial.
How to start using Git and GitHub
Step 1 -Install Git
Git comes preinstalled in some Macs and Linux-based system, but you can always check if you have Git installed in your machine by typing git version in your terminal. You can use the Command Prompt to do this
As you can see above, i have Git version 2.31.1 installed on my my windows computer. If you don’t have Git installed in your computer, you won’t get a version.
You can download Git here and then select your operating system to download.
Follow the necessary installer guide until installation is complete. Open the command prompt and type git version to verify that Git was successfully installed.
Step-2 Create a GitHub Account.
To create an account on GitHub, you will be asked some personal information like name, confirm your email, set a username and password, and your account should be set up in minutes.
Create an account on GitHub.com
Step-3 Connect your GitHub account to your Git account.
You’ll do this from your terminal.
To set your Git username, type this in your terminal:
git config — — global user.name “emmanarthur4488”
To confirm that you have set your Git username correctly, type this:
git config — — global user.name
You should have “emmanarthur4488” as the output.
To set your Git email, type this in your terminal:
git config — — global user.email “abcdefghij@gmail.com”
To confirm that your have set your Git email correctly, type this:
git config — — global user.email
You should have “youremail@gmail.com” as the output
Get Emmanuel Victor Arthur’s stories in your inbox
Join Medium for free to get updates from this writer.
You will be asked to authenticate your GitHub account, so just sign in with the same email to confirm.
Step-4 Create and edit your code files locally
Step-5 Create a repository on GitHub
Click the + sign at the top right corner to create a new repository.
Repositories are like your folders online.
You will be prompted to this page:
Name your repository and give it a description (this is optional).
Click the “Create repository” you will be prompted to this page:
Step-6 Push your local code to GitHub
You can use the code editor builtin terminal to use Git to push your code to GitHub. Click ctrl+shift+` to open the terminal in VScode.
Input the command below one after the other in your terminal. Press the Enter key to proceed after every input.
git init
git add .
git commit “first commit”
git branch -M main
remote add origin
https://github.com/emmanarthur4488/sample.code.git
git push -u origin main
common Git Commands to know
They are many Git command you can use in the terminal, and that can get overwhelming. So i’d suggest focusing on some of the most popular ones first.
Here they are:
git init lets you initialize Git in your folder.
git add . lets you add all files in the present folder.
git commit stores the added files. use -m for message followed by the actual message.
git branch create a new branch which is a version of the repository as it appears when added. and -M to move the name to main
git remote add origin finally connects the local folder to the repository on GitHub. It is followed by the repository’s link.
git push -u origin main pushes the code to GitHub. The -u flag create a tracking reference for the branch, and origin main puts the code in the main branch
Those are some of the main commands you’ll use all the time. This is a beginner and non-technical guide to help you get started using Git and GitHub, so we won’t go into too much more detail here.
The more you continue using GitHub, the more comfortable you’ll get using these commands. The key is to start small and maintain your momentum.
It will eventually get easier as you build small project and host them on GitHub using Git.
If you find it hard to use the terminal to navigate between folders, spend some time to practice with it. Again, it get easier with time and use.
Resources to learn Git and GitHub
Here are some helpful courses and articles you can go through if you want to learn Git and GitHub in more detail:
- Git and GitHub Tutorial-version control for Beginners
- Basic Git Commands-How to use Git in real project
- Git and GitHub for Beginners crash course
- An introduction to Git: what it is, and how to use
- About GitHub
Conclusion
If you have finished reading this, you might be feeling overwhelmed about Git and GitHub. Yes it’s another big thing you need to learn in tech, but do not fret.
Remember that whenever you start learning something new, at first it can seem like you won’t get the hang of it. But after some time and hard work you’ll become more comfortable.
Thanks for reading this article. If you enjoyed it,consider sharing it to help other developers.
You can reach me on Twitter, Linkedin and GitHub.
Happy Learning.






