Skip to main content

Command Palette

Search for a command to run...

Git & GitHub: A Beginner’s Guide to Version Control (Made Simple)

Updated
5 min read
Git & GitHub: A Beginner’s Guide to Version Control (Made Simple)

If you're aiming for a career in software, cloud engineering, DevOps, or any modern tech role, learning Git and GitHub will make collaborating and managing code much easier.

In this guide, you'll learn:

  • What Git and GitHub are

  • How to install and configure Git

  • How to create a repository

  • How to make commits

  • How to push and pull code

Let's dive in.

What is Git?

Git is a version control system.

Version control is the process of tracking changes to your code over time.

It's a tool that runs on your computer to save and track changes to your files.

What is GitHub?

GitHub is a cloud platform where Git repositories are stored online.

While Git works on your computer, GitHub allows you to:

  • Store code online

  • Collaborate with other developers

  • Share projects

  • Back up your work track

Git tracks changes locally on your computer; GitHub stores and shares repositories online.

Installing and Setting Up Git

Before using Git, you need to install it.

Step 1: Download Git

Install Git: https://git-scm.com

Download the version for your operating system and install it.

Step 2: Verify Installation

Open your terminal (Git Bash) and run.

You should see something like this:

This confirms Git is installed.

Step 3: Configure Git

Git needs to know your name and email so it can record who made changes.

Example:

  • git config --global user.name "Your Name"

  • git config --global user.email "you@example.com"

This only needs to be done once.

Creating a Repository

A repository (repo) is simply a folder where Git tracks your project.

Step 1: Create a Project Folder

Example:

Step 2: Initialize Git

To initialize Git, Run:git init

Git will respond with: initialized empty Git repository

Your project is now a Git repository.

This folder stores all version history.

Adding Files to Git

To add all files, use: git add

This moves the files to something called the staging area.

Making Your First Commit

A commit is like saving a snapshot of your project at a specific moment.

If you run the git status command, it will show that there's no commit yet

It's like a report card for your repository. It tells you the current state of your Git project and what's going on

To make a commit, run: git commit -m "message"

Now Git permanently records that version of your code.

Each commit includes:

  • What changed

  • Who made the change

  • When it happened

Creating a Repository on GitHub

Now let's store the project online.

Step 1: Go to GitHub

Visit: https://github.com

Create an account if you don't already have one.

Step 2: Create a New Repository

Click the "+" drop-down in your GitHub home page.

Then click "New Repository."

Fill in:

  • Repository name

  • Description (optional)

  • Choose Public or Private

Click Create Repository.

GitHub will generate commands for connecting your local project.

Connecting Git to GitHub

To push your code to GitHub, you need to connect Git to GitHub

  • Copy the repository URL you created from GitHub

  • Paste it into the Git Bash

  • Run git push origin master

  • If you haven't connected it before, it will show you a pop-up labeled "Sign In."

After signing in successfully, you should see something like this:

Pushing Code to GitHub

Once you're connected to GitHub, your code will be sent there.

The code "Hi. this is Baribor, I'm a Cloud DevOps Engineer" is now live on GitHub.

Pulling Code from GitHub

If you make any updates on GitHub, you can download them using the command:git pull origin master

  • Fetches the latest changes

  • Updates your local project

This is very common when working with teams.

So here, the code is changed from "Hi. This is Baribor, I'm a Cloud DevOps Engineer" to "Hi. This is Baribor, I'm a Cloud DevOps Engineer. Welcome!"

Run the update on git with the command "git pull origin master."

To check the new update, run "cat index.html." This shows the new update.

Why Git Is So Powerful

Git is powerful because it allows you to:

  • Safely experiment with code

  • Collaborate with teams

  • Track every change

  • Recover lost work

  • Build professional portfolios

This is why every modern software and cloud project uses Git.

For roles like cloud engineers and DevOps engineers, Git is used daily to manage the following:

  • Infrastructure code

  • Automation scripts

  • Application deployments

Final Thoughts

Git and GitHub are fundamental tools in modern software development.

Once you understand the basic workflow:

You already know the foundation of professional version control.

From here, you can explore more advanced features like the following:

  • Branching

  • Pull requests

  • Merging

  • CI/CD integration

Mastering Git will make you far more effective as a developer, cloud engineer, or DevOps professional.