DEV Community

Cover image for Understanding Git and GitHub as a Beginner
Adithyan G
Adithyan G

Posted on

Understanding Git and GitHub as a Beginner

When I first started learning to code, Git and GitHub were two things that completely confused me.

I kept asking myself questions like:

  • Are Git and GitHub the same thing?
  • Why do I need them?
  • What does commit, push, or pull even mean?

If you’re a beginner and feel the same way, this post is for you. I’ll explain Git and GitHub in simple terms, without assuming prior knowledge.


What Is Git?

Git is a version control system.

That sounds complex, but here’s a simple way to think about it:

Git is like a save history for your code.

Instead of having files like:

  • project-final
  • project-final-v2
  • project-final-really-final

Git keeps track of every change you make in an organized way. You can:

  • Go back to older versions
  • See what changed and when
  • Experiment without fear of breaking everything

Git works locally on your computer.


What Is GitHub?

GitHub is a platform that stores Git repositories online.

If Git is your local save history, then GitHub is:

  • A backup of your code on the internet
  • A collaboration platform for working with others
  • A portfolio to show your projects

In short:

  • Git → version control tool
  • GitHub → place to host Git repositories

Repository (Repo)

A repository is just a project folder that Git is tracking.

It contains:

  • Your project files
  • The entire history of changes

You can have repositories:

  • Locally (on your machine)
  • Remotely (on GitHub)

Basic Git Workflow (Beginner-Friendly)

Here’s the basic flow most beginners use:

  1. Make changes to your code
  2. Tell Git which files you want to save
  3. Save those changes with a message
  4. Send them to GitHub

Let’s break that down.


git init – Start Tracking a Project

git init
Enter fullscreen mode Exit fullscreen mode

This command tells Git:

“Start tracking this folder.”

It creates a hidden .git folder that stores the history

git status – Check What’s Going On

git status
Enter fullscreen mode Exit fullscreen mode

This shows:

  • Which files were changed

  • Which files are ready to be saved

  • Which files are not tracked yet

This is one of the most useful Git commands.

git add – Stage Changes

git add .
Enter fullscreen mode Exit fullscreen mode

This tells Git:

“I want to include these changes in the next save.”

Think of this like selecting files before clicking Save.

git commit – Save Changes

git commit -m "Add initial project files"
Enter fullscreen mode Exit fullscreen mode

A commit is a snapshot of your project at a point in time.

The message should briefly explain what changed.

Good commit messages matter more than you think.

Connecting Git to GitHub

Once your project is on GitHub, you connect it to your local project:

git remote add origin <repository-url>
Enter fullscreen mode Exit fullscreen mode

Now Git knows where your remote repository lives.

git push – Send Code to GitHub

git push origin main
Enter fullscreen mode Exit fullscreen mode

This uploads your commits from your computer to GitHub.

If GitHub is empty and your local project has code, this is how you publish it.

git pull – Get Updates from GitHub

git pull origin main
Enter fullscreen mode Exit fullscreen mode

This brings changes from GitHub to your local machine.

Useful when:

  • You’re working on multiple devices

  • You’re collaborating with others

Branches (Very Simple Explanation)

A branch is a separate line of development.

You can:

  • Experiment safely

  • Work on features without breaking the main code

Beginners usually start with the main branch, and that’s perfectly fine.

Common Beginner Mistakes (I Made These)

  • Being afraid of Git commands

  • Forgetting to commit often

  • Writing vague commit messages

  • Thinking GitHub automatically saves code

Git only saves when you tell it to.

Why Git and GitHub Matter

Even as a beginner, Git and GitHub help you:

  • Build good habits early

  • Track progress over time

  • Collaborate confidently

  • Create a public coding portfolio

You don’t need to master everything at once. Just understanding the basics is enough to get started.

Final Thoughts

Git and GitHub feel overwhelming at first, but they become clearer with practice.
The key is to use them regularly, even for small projects.

If you’re learning to code, start using Git now, not later.

Thanks for reading. If you’re also a beginner, feel free to share your experience or ask questions in the comments.

Written by Adithyan G, MERN stack developer.

Portfolio: adithyan-phi.vercel.app/

Top comments (0)