Introduction to Git and GitHub for Beginners

Introduction to Git and GitHub for Beginners
Imagine you’re writing a book. After a few weeks, you realize you’ve made some mistakes in Chapter 1. Without backups, fixing it means scrolling through old drafts or starting over. Frustrating, right?
This is the problem Git solves for developers: it tracks every change you make to your project so you can go back in time, collaborate with others, and never lose your work. Pair it with GitHub, and you can store projects online, share them, and even showcase your skills to employers.
In this post, we’ll break Git and GitHub into simple steps so you can start using them today.
Step 1: What is Git (and Why Should You Care)?
Git is a version control system. Think of it as a time machine for your code:
-
It tracks every edit you make.
-
You can roll back to a previous version anytime.
-
You can work with others without overwriting each other’s work.
Step 2: What is GitHub?
If Git is your time machine, GitHub is the cloud where you park it. It’s an online platform where you can:
-
Store your projects safely.
-
Collaborate with other developers.
-
Show your work to clients or employers.
You can use Git without GitHub, but most developers use both together.
Step 3: Install Git
-
Go to git-scm.com.
-
Download the version for your operating system.
-
Follow the installation prompts (default settings work fine).
-
Open your terminal (Command Prompt, PowerShell, or Mac Terminal).
Run:If it shows a version number, you’re good to go.
Step 4: Create Your First Git Project
-
Create a new folder, e.g.,
my-first-git-project
. -
Open it in your terminal and type:
This creates a Git repository—your project is now being tracked.
-
Add a test file, e.g.,
index.html
.
Step 5: Save Your First Snapshot (Commit)
A commit is like taking a picture of your project at a moment in time.
'git add .'
- Tells Git to track changes.
'git commit -m "Message"' -
Saves the snapshot with a short message describing what you did.
Step 6: Push to GitHub
-
Create a free GitHub account at github.com.
-
Click New Repository and give it a name.
-
Copy the repository URL.
-
Link your local project to GitHub:
-
Refresh GitHub, and you’ll see your project online!
Step 7: Make a Change and Update GitHub
-
Edit your
index.html
file. -
Run:
-
Check GitHub; the changes are now live.
Why Learn Git and GitHub Early?
-
You never lose work again.
-
Collaboration becomes smooth and organized.
-
Employers expect it; it’s part of being a professional developer.
Takeaway:
Git is your safety net. GitHub is your portfolio. Start using them today, even for small projects, and you’ll thank yourself later.
You may also like
Comments
No comment yet