If you want to work as a developer, Git and GitHub are not optional skills. Almost every professional software project uses them for version control and collaboration.
When I first started learning Git, it felt confusing. Terms like commit, branch, remote, and merge sounded complicated. But once you understand the workflow, Git becomes one of the most powerful tools in a developer’s toolkit.
This post explains how to actually learn Git and GitHub step by step, with a practical workflow you can start using immediately.
What Git Actually Is
Git is a version control system.
It tracks changes in your code over time so you can:
- go back to previous versions
- see what changed
- collaborate with other developers
- safely experiment with new features
Think of Git like save points in a video game for your code.
Instead of manually copying folders like:
project_v1
project_v2
project_final_final
project_final_really_final
Git manages versions automatically.
What GitHub Is
GitHub is a cloud platform for hosting Git repositories.
It lets you:
- store your code online
- collaborate with other developers
- track issues
- review code changes
- deploy projects
In simple terms:
Git = version control tool
GitHub = platform that hosts Git repositories
Installing Git
First install Git on your system.
Download it from:
https://git-scm.com
After installation verify it:
git --version
Then configure your identity:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Git will attach this information to your commits.
Basic Git Workflow
The core Git workflow looks like this:
edit files
↓
git add
↓
git commit
↓
git push
Each step has a specific purpose.
Step 1: Initialize a Repository
Create a project folder and initialize Git.
git init
This creates a hidden folder:
.git
This directory stores the entire version history of your project.
Step 2: Add Files
Git does not automatically track files. You need to stage them.
git add .
This tells Git:
"Include these files in the next commit."
Step 3: Create a Commit
A commit is a snapshot of your project at a specific moment.
git commit -m "initial project setup"
Each commit should describe the change you made.
Examples:
add login page
fix navbar bug
update API logic
Step 4: Connect to GitHub
Create a repository on GitHub.
Then connect your local repo:
git remote add origin https://github.com/username/project.git
This tells Git where the remote repository is.
Step 5: Push Code
Upload your code to GitHub.
git push -u origin main
Now your project is stored online.
Everyday Git Commands
Here are the commands you will use most often.
Check project status:
git status
See commit history:
git log
Pull latest changes from GitHub:
git pull
Push new commits:
git push
Branching (One of Git’s Best Features)
Branches let you work on features without breaking the main codebase.
Create a branch:
git checkout -b new-feature
Switch branches:
git checkout main
Merge changes:
git merge new-feature
This is how large teams safely develop software.
A Simple Real Workflow
Here is a realistic workflow developers use daily.
- pull latest code
- create new branch
- write code
- commit changes
- push branch
- open pull request
Example:
git pull
git checkout -b add-auth-system
git add .
git commit -m "implement authentication"
git push origin add-auth-system
Best Way to Actually Learn Git
The best way to learn Git is by using it on real projects.
Here are a few things you can do:
- build small coding projects
- push every project to GitHub
- contribute to open source
- collaborate with friends
After a few weeks of using Git daily, the commands become second nature.
Final Thoughts
Git can feel intimidating at first, but once you understand the workflow it becomes incredibly powerful.
Learning Git will help you:
- manage your code safely
- collaborate with other developers
- build a strong portfolio
- work on professional software projects
If you're serious about programming, Git and GitHub should be tools you use every day.
If you're reading this, try this right now:
git init