If you're learning to code, you’ll quickly notice something: writing code is only half the work. The other half is managing change.
You’ll build a feature, adjust it, break something, fix it, then later wish you could “go back to the version that worked yesterday.”
That’s exactly the problem Git was built to solve.
In this article, you’ll learn what Git is, why version control matters, and how to use Git Bash + GitHub to push and pull code confidently — plus how to track changes properly.
What Git is (and why version control matters)
Git is a version control system. It helps you track changes made to your files over time.
Instead of saving multiple copies like:
project_final.zipproject_final_real.zipproject_final_please_work.zip
Git stores a clean history of your project, and you can move between versions whenever you need to.
Version control is important because it helps you:
- recover from mistakes
- see what changed and when
- collaborate without overwriting each other’s work
- experiment safely
If Git is the tool that tracks changes locally on your computer, GitHub is the platform that stores Git projects online. It’s where you back up your work and share it with others.
Installing Git Bash (Windows)
On Windows, the easiest way to use Git is through Git Bash — a terminal that lets you run Git commands.
To install it:
- Download Git from the official site: https://git-scm.com/downloads
- Install it (default settings are fine)
- Search for Git Bash in the Start Menu and open it
Once Git Bash opens successfully, you’re ready to start using Git.
Connecting Git to your GitHub account
Before you start saving versions of your work, Git needs to know who you are. This information is attached to your commits (think of commits like signed checkpoints).
In Git Bash, set your name and email:
git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"
You can confirm your settings with:
git config --global --list
Tip: Use the same email address that you use on GitHub so your commits show up correctly on your profile.
Your first Git workflow: tracking changes locally
A Git project starts inside a folder. Once Git is enabled, it begins watching your files and tracking what changes over time.
If you already have a project folder, move into it. Then initialize Git:
git init
From this point, Git starts monitoring the folder.
Now here’s where beginners often get confused: Git has two main stages before your work is saved in history.
1) Staging
Staging means selecting what you want to include in your next snapshot.
git add .
2) Committing
A commit is the snapshot itself — a saved point in history.
git commit -m "Initial commit"
If you ever want to check what Git sees in your project, use:
git status
This command tells you:
- which files changed
- which ones are staged
- which ones are still untracked
Pushing your code to GitHub
Saving your work locally is great, but pushing to GitHub is what makes your project shareable and safely backed up online.
To push code, you’ll need a GitHub repository first:
- Log in to GitHub
- Create a new repository
- Copy the repository link (HTTPS is fine for beginners)
Back in Git Bash, connect your local project to GitHub:
git remote add origin https://github.com/USERNAME/REPOSITORY.git
Then push your commits:
git branch -M main
git push -u origin main
Once that completes, refresh your GitHub repository page — you should see your files there.
That’s your first successful push 🎉
Pulling code from GitHub (keeping your project updated)
As soon as you start working with GitHub, your project now has two versions:
- your local version (on your computer)
- the remote version (on GitHub)
When you want to download the latest updates from GitHub into your computer, you pull:
git pull origin main
This is especially important when:
- you’re collaborating with teammates
- you edited the repo on GitHub directly
- you’re switching between devices
If you don’t have the project locally at all (first time), you use clone:
git clone https://github.com/USERNAME/REPOSITORY.git
Cloning is like copying the whole project from GitHub to your machine, including the Git history.
Tracking changes like a developer
Git becomes truly powerful when you use it to understand what’s happening in your project, not just to upload code.
Here are the most useful commands for tracking changes:
Checking what changed
git status
This is your project dashboard.
Seeing the exact line changes
git diff
This shows what changed line-by-line before you commit.
Viewing your project history
git log --oneline
This gives you a clean summary of your commits and messages.
The simple daily workflow
Most developers repeat the same cycle:
git status
git add .
git commit -m "Describe what changed"
git push
And when working with others:
git pull
If you master these commands, you can confidently manage almost any beginner project.
Final thoughts
Git is not just a tool you must learn — it’s a safety net.
It helps you build projects without fear, recover quickly from mistakes, and work like a professional even on small personal projects.
Once you get comfortable with commits, push, pull, and tracking changes, GitHub becomes a natural part of your workflow.
Happy coding 🚀
Top comments (0)