A Beginner's Guide to Git : Understanding Version Control

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

Source: Dev.to

Introduction

When you first hear about Git, it can sound intimidating, but once you understand why Git exists and how the basic commands work, everything starts to make sense. This guide will walk you through:

  • What version control is (in layman’s language)
  • How Git tracks changes
  • How to push and pull code
  • The most common Git commands

Imagine saving multiple versions of a document manually:

project_final.docx
project_final_v2.docx
project_final_really_final.docx

Now imagine doing this with code, across months or years, with several people. That’s where version control comes in.

  • Track changes over time
  • Go back to older versions if something breaks
  • Collaborate without overwriting each other’s work
  • Know who changed what and when

Git is the most popular version control system. It runs on your computer, tracks changes in your project files, lets you save “snapshots” of your work, and connects your local project to online platforms like GitHub or GitLab.

Key Git Concepts

Repository (Repo)

  • Local repository – the folder on your computer that Git tracks.
  • Remote repository – an online copy (e.g., on GitHub).

You write and edit code locally; changes exist there until you commit and push them to the remote.

Staging

Before saving changes, Git asks: “Which changes do you want to include?”
The staging area is where you prepare those changes. A commit is a saved snapshot of your project. Each commit:

  • Has an ID (identifier)
  • Has a description (commit message)
  • Can be restored later

Installing Git

Check if Git is installed:

git --version

If it isn’t installed:

  • Linux

    sudo apt install git
  • macOS

    brew install git
  • Windows – download from

Initializing a Repository

Navigate to your project folder and run:

git init

This tells Git to start tracking the folder.

Basic Git Workflow

Checking Status

git status

Shows modified files, staged files, and what Git is waiting for.

Adding Changes

  • Add a specific file:

    git add project1.py
  • Stage all changes:

    git add .

Committing

git commit -m "Add python file"

💡 Tip: Write commit messages as clear explanations for humans.

Pushing

git push origin main
  • Sends your commits to the remote repository (e.g., GitHub).
  • After pushing, your code is online, others can access it, and your work is backed up.

Pulling

git pull origin main
  • Retrieves the latest changes from the remote repository.
  • Run git pull before you start working to ensure you’re up‑to‑date.

Typical daily loop:

git pull
# make changes
git status
git add .
git commit -m "Describe what you changed"
git push

Viewing Log

git log

Shows commit history, authors, timestamps, and messages.

Essential Commands to Remember

  • git status
  • git add
  • git commit
  • git push
  • git pull

With practice, you’ll become comfortable with Git and be able to manage projects efficiently.

Happy coding! 🚀

Back to Blog

Related posts

Read more »

Git for Beginners

markdown Introduction If you are learning programming or working with code, you will hear the word Git everywhere. Git can feel confusing at first, but once you...