Git & GitHub in Easy Steps: Save, Share and Show Your Code
Git keeps a history of every change in your code, so you can go back anytime. GitHub stores that history online and becomes your public portfolio.
By Learn Refill Mentors · Updated
Why learn Git & GitHub?
- Every software company uses Git
- Recruiters look at your GitHub profile
- You never lose your work again
1Start tracking a project
Open a terminal in your project folder and turn it into a Git repository.
git init
git status2Save a snapshot (commit)
Add the files you want to save, then commit them with a clear message.
git add .
git commit -m "Add homepage layout"3Work safely on a branch
A branch lets you try new features without breaking the main code.
git checkout -b feature/contact-form
# ...make changes and commit...
git checkout main
git merge feature/contact-form4Put your code on GitHub
Create an empty repository on GitHub, connect it and push.
git remote add origin https://github.com/you/portfolio.git
git push -u origin main5Keep your repositories clean
Add a .gitignore so secrets and heavy folders are never uploaded, and write a short README for every project.
node_modules/
.env
.next/Common mistakes
- Committing .env files with passwords or API keys
- Writing messages like 'update' — be specific
- Working directly on main for every change
Practice task
Push your portfolio project to GitHub with a README that explains what it does and how to run it.
Frequently asked questions
What is the difference between Git and GitHub?
Git is the tool on your computer that tracks changes. GitHub is a website that stores Git repositories online.