Git & GitHub Tutorial for Beginners

Git & GitHub Tutorial for Beginners

Photo by Roman Synkevych on Unsplash

Understanding and Adapting Git and GitHub is a sector a lot of new developers in the tech industry struggle with. I will be simplifying concepts on Git and GitHub in this article using practical steps and simple definitions for easy assimilation. At the end of this article you should be able to:

  • Understand Version control system and its benefits

  • Understand Git and GitHub

  • Create a GitHub repository

  • Make commit change

Michelle obama gif

What is Git?

Photo by Wikimedia.org

Git is a free distributed version control system specifically designed to work with text files.

From the definition above, you would notice that one of the keywords in the definition is the version control system, and to understand Git well, one has to understand the Version control system.

A Version Control is any system that allows you to understand the history of a file and how it has progressed.

Think of the version control system as an album of pictures of you created by your parents from when you were a baby to now you are an adult. This album contains exact details of different versions of you from childhood to adulthood. The pictures in this album will make identifying your physical traits at every point of your life easier for you and the notes will provide detailed information on the event that had taken place, This is how a Version control system works.

Benefits of a version control system(VCS)

  • Promotes Speed and Traceability

A version control system provides history on files such as creation and deletion of files, edits to their contents, the purpose for edits, etc. These features make problems to be easily identified and resolved if necessary.

  • Promotes Team Work

VCS has features like branching and merging that promote the breakdown of labor during teamwork. Individual works are appreciated, and high productivity by team members is achieved.

Now that you have established what version control system is , you should note that there are different types of version control systems like **Local Version Control Systems ** Centralized Version Control Systems and Distributed Version Control Systems

Git is a type of distributed version control system that records differences in the files and folders and keeps a historical record of each save. it’s very efficient with large projects and has an incredible branching system.

To work with effectively with Git, you should first familiarise yourself with the basic. The basics in this context consists of the terms and commands that you would use regularly as you work with Git. Some of these are:

  • Git repository,

  • Git commit,

  • Git status,

  • Git branch, etc.

There's so many terminologies around Git, however, I will only be focusing on the two that are most relative to this post - Git repository and Git commit.

What is a Git Repository?

A Git repository "Git repo" for short is a container for projects you want to track. it is a file location where all the files related to your project are stored. A Git repo can either be local or remote.

Git local repository is the one on which we will make local changes, typically this local repository is on our computer. Git remote repository is one of the servers, typically a machine situated 42 miles away.

Photo by kevintshoemaker


A Git commit is a snapshot of your repo at a specific point in time.

git commit pics 1.png

A Git commit is one of the basic Git commands. Each Git commit represents a snapshot of your repo at different points, and all of your commits will come together to form your repository's history.

##Where does GitHub come in?

Photo by Mohammed Rahm

GitHub has lots of features and advantages but I'll be focusing solely on its relationship with Git.

Remember that photo album that contained different pictures of you? Now, imagine your parent put it in a space where everyone you knew at different points of your life could have access to it. Access to add pictures or correct some of the notes written by your parents. It would be a huge comprehensive album, right? lol, This is exactly what GitHub does with Git repos and commits.

GitHub is a code hosting platform for version control collaboration and is ideal for project works.

GitHub lets you store your work (which is annotated by Git commits) in a special online folder (repo)

GitHub takes your commit, repo and hosts it online so that anyone can access it from any computer. Below is a representation of Git and GitHub's relationship:

Photo by Eureka.co

In summary, GitHub is an online host that utilizes a Git version control system.


Creating a Git repository in GitHub

Before following the following step, I assume you already have a GitHub account. If you don't have one, you can create one by going to github.com/join. After that, you can continue with the steps below:

  • Sign in to your GitHub account, click on the dropdown menu beside your profile picture and select New repository

sign in repo.png

  • Type a memorable name for your repository

memorable git repo.jpeg

  • Add a description of your repo ('This is optional but ideal')

description repo.jpeg

  • Choose a repository visibility

repo visibility.jpeg

  • Choose to Initialize this repository with a README file

Readme snapshot.jpeg

  • Click Create a repository

    New repo.jpeg


How to commit a change to your New repository

  • Go to your profile and click on the repository

  • In your repository's list of files, click README.md.

readme directory.jpeg

  • Click On the Edit icon and type in some more information.

more info.jpeg

  • Click Preview to view new content and update a concise commit message that describes the changes you made to the file.

preview first repo.png

  • Choose a branch for your commit. If your current branch is the default branch, it is ideal for you to choose to create a new branch and a new pull request.

branch commmit.png

  • Click Propose file change

propose file.png

Congratulations on creating your first repository and making your first commit change!!🥳

Congratulations gif

Before I end this article, I will love to do a quick RECAP

Git is a type of Version control system that tracks the changes made to files, so you have a record of what has been done, and be able to revert specific versions should the need arise.

GitHub is a code hosting platform that utilizes a Git version control system.

Git Repository is a file location where all the files related to your project are stored.

Git commit is a snapshot of your repo at a specific point in time.

Thank you for getting to the end of this article, I hope I was able to simplify complicated Git and GitHub concepts. Do well to constantly practice what you've learned as "practice makes progress". Also, Don't forget to follow me for more simplified and interesting tech articles.

The end gif