Git and GitHub are essential tools for modern developers. Whether you’re working on a personal project or collaborating with a team, knowing how to clone a repository, make changes locally, and push updates back to GitHub is a must-have skill. In this guide, I’ll walk you through the entire Git workflow step by step, in a simple and beginner-friendly way.
Step 1: Install and Verify Git
Before anything else, make sure Git is installed on your system.
git --version
If Git is installed, you’ll see a version number. If not, download it from the official Git website.
Step 2: Clone the GitHub Repository
If you open Terminal / Git Bash directly in the folder where you want the project, you can start cloning immediately:
git clone https://github.com/USERNAME/REPOSITORY_NAME.git
cd REPOSITORY_NAME
Step 3: Create a New Branch (Best Practice)
Instead of working directly on the main branch, create a new one:
git checkout -b feature-update
This keeps your main branch clean and safe.
Step 4: Work on Your Project
Now open the project in your code editor and make the required changes.
Step 5: Stage Your Changes
Add all modified files to the staging area:
git add .
Step 6: Commit Your Changes
Save your changes with a meaningful commit message:
git commit -m "Improved homepage layout and fixed navigation issue"
Step 7: Push Changes to GitHub
Push your branch to GitHub:
git push origin feature-update
Your changes are now live on GitHub 🎉
Step 8: Merge Changes into Main Branch (Optional)
If everything looks good, merge your branch into the main branch:
git checkout main
git pull origin main
git merge feature-update
git push origin main
Useful Git Commands (Quick Reference)
git log --oneline # View commit history
git diff # See code changes
git branch -a # List all branches
git checkout main # Switch branch
Final Thoughts
Learning Git may feel confusing at first, but once you understand the workflow, it becomes a powerful tool that saves time and prevents mistakes. By following these steps, you can confidently clone repositories, work locally, and push updates like a professional developer.