Understanding Git and GitHub: A Biginners Guide

Published: (January 18, 2026 at 01:06 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

What is Git?

Git is a version control system that helps you keep track of changes made to your code. Instead of saving many copies of the same project, Git records each change and stores it as part of the project history.

With Git you can always go back to an earlier version of your code if something goes wrong. Git works locally on your computer and does not need an internet connection to track changes.

Why version control is important

Version control is important for several reasons:

  • It helps you avoid losing your work.
  • You can see what changes were made and when.
  • It allows multiple people to work on the same project.
  • You can easily fix mistakes by going back to a previous version.

In real software projects, version control is necessary because code is constantly changing.

Git and GitHub Difference

Git and GitHub are not the same thing.

  • Git is the tool that tracks changes on your computer.
  • GitHub is an online platform where you store and share your Git repositories.

You use Git commands to push your code to GitHub or pull code from GitHub.

Setting up Git on your computer

Before using Git, make sure it is installed and configured.

Check Git version

To confirm Git is installed:

git --version

Configure your name and email

Git uses this information to track who made changes.

git config --global user.name "okwemba"
git config --global user.email "okweembaajoseph@gmail.com"

To confirm the configuration:

git config --global --list

Setting up SSH

SSH allows you to connect to GitHub securely without entering your password every time.

Generate SSH key

ssh-keygen -t ed25519 -C "okwembaajoseph@gmail.com"

Press Enter to accept the default file location.

Start the SSH agent

eval "$(ssh-agent -s)"

Add SSH key

ssh-add ~/.ssh/id_ed25519

Copy the public key

cat ~/.ssh/id_ed25519.pub

Copy the output and add it to GitHub → Settings → SSH and GPG keys.

How to push code to GitHub

Open your project in the terminal and follow these steps:

  1. Initialize Git

    git init
  2. Check file status

    git status
  3. Add files

    git add .
  4. Commit changes

    git commit -m "My first commit"
  5. Connect to GitHub repository

    git remote add origin https://github.com/username/repository-name.git
  6. Push the code

    git push -u origin main

Your code will now appear on GitHub.

How to pull code from GitHub

Pulling means getting the latest version of the project from GitHub:

git pull origin main

This is useful when collaborating with others or when switching devices.

How to track changes using Git

  • See changed files

    git status
  • See what exactly changed

    git diff
  • View commit history

    git log

These commands help you understand how your project has changed over time.

Conclusion

Git is an essential tool for developers. It helps you manage your code, track changes, and collaborate with others.

Back to Blog

Related posts

Read more »

Git and GitHub: A Beginner's Guide

markdown !Cover image for Git and GitHub: A Beginner's Guidehttps://media2.dev.to/dynamic/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3...