DEV Community

Judy Wambugu
Judy Wambugu

Posted on

A Beginner-Friendly Guide to Git, GitHub, and Version Control

Git for Beginners: What it is, Why it matters and how to use it with GitHub

If you are new to tech, data or programming, you've probably heard people talk about Git and GitHub a lot, and maybe felt a bit confused. I know I did.

This article explains Git in simple terms, why it's important and how to use it to:

  • Track changes in your code

  • Push your work to GitHub

  • Pull updates from GitHub

  • Avoid losing progress when things break

What is Git?

Git is a version control system.It is a local tool that tracks every change you make to your code. Think of it like "Track Changes" in Microsoft Word, but for code.

That means Git helps you:

  • Keep track of changes in your file

  • Save different versions of your work

  • Go back in time if something breaks

  • Work safely without losing progress

  • It also lets multiple people work on the same code without overwriting each other.

Git runs on your computer and works quietly in the background. Every time you make a change, Git can take a snapshot of your project. These snapshots are called commits.

The command-line program to interact with Git is called GitBash. Another GUI where you can also use Git is Visual Studio Code (VS Code)

Why is Version Control Important?

Before Git, people used to save 20 versions of a file, copy folders as backups and panic when something breaks.

Version control is a core skill in tech, data and software roles.

What is GitHub (and how is it different from Git)?

This part often confuses beginners.

  • Git → Tracks changes locally on your computer
  • GitHub → Stores your Git projects online

GitHub is a cloud platform where you:

  • Back up your code
  • Share projects
  • Collaborate with others
  • Build a public portfolio

GitHub works with Git, it doesn’t replace it.


Basic Git and GitHub Workflow (How Git, GitBash and GitHub intergrate)

Here’s the normal flow:

  1. Write code on your computer using GitBash or VS Code which are the interface to Git
  2. Git tracks the changes
  3. You save a snapshot (commit)
  4. You push it to GitHub which is your cloud storage
  5. Others (or future you) can pull it later

How to Track Changes Using Git

Once Git is set up in a project folder, it automatically notices when files change.

Common Git actions:

  • Status → What changed?
  • Add → Select changes to save
  • Commit → Save a snapshot

Example:

bash
git status

This command tells you:

  • Which files changed

  • Which files are ready to be committed

  • What Git is waiting for you to do next

Saving Changes (Add and Commit)

To save your work in Git, you usually do two things:

bash
git add
git commit -m "Describe what you changed"
Enter fullscreen mode Exit fullscreen mode
  • git add → selecting files
  • git commit → clicking save

How to Push Code to GitHub

Once your changes are committed locally, you can send them to GitHub using the following code:

bash
git push origin main
Enter fullscreen mode Exit fullscreen mode

This uploads your commits to the remote repository on GitHub.

Now your work is:

  • Backed up online

  • Visible to others

  • Safely stored even if your laptop breaks

How to Pull Code to GitHub

If you’re working on multiple devices, or collaborating with others, you’ll need to pull updates from GitHub:

bash
git pull origin main
Enter fullscreen mode Exit fullscreen mode

This downloads the latest changes and updates your local project.

Top comments (0)