Article Information
Category: Full Stack Development | Career Insights
Updated: december 3, 2025
Reading Time:6 min
Tabe of Contents
Mastering Git & GitHub: From Basics to Advanced Commands
Updated: december 3, 2025
Git is one of the most important tools for developers. It helps you track every change in your code, work with teammates, and manage your projects efficiently. In this post, weโll learn everything about Git and GitHub โ from basic commands to a few advanced tricks that will make your workflow faster and more professional.
๐ What is Git?
Git is an open-source version control system that tracks changes in your source code. It helps developers maintain project history, collaborate effectively, and roll back to previous versions when needed.
โ๏ธ What is GitHub?
GitHub is a cloud-based platform that hosts your Git repositories online. It allows you to store your code, collaborate with teammates, review pull requests, and contribute to open-source projects easily.
In short:
Git = Tool for version control (local)
GitHub = Platform to host and collaborate on Git repositories (online)
โ๏ธ Step 1: Setup Git
git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
These commands identify your commits with your name and email.
๐ Step 2: Initialize a Repository
git init
This command initializes a new Git repository in your project folder.
๐งฉ Step 3: Add Files
git add .
Adds all files to the staging area, preparing them for commit.
๐พ Step 4: Commit Changes
git commit -m "Initial commit"
Commits your code changes with a message. Each commit is a snapshot of your project.
๐ Step 5: Connect with GitHub
git remote add origin https://github.com/username/repository.git
Links your local Git project with a GitHub repository.
โฌ๏ธ Step 6: Push to GitHub
git push -u origin main
Uploads your commits from local to GitHub.
โฌ๏ธ Step 7: Pull Changes
git pull origin main
Fetches and merges the latest changes from the GitHub repository.
๐ฟ Step 8: Branch Management
git branch feature-login
git checkout feature-login
Create and switch to new branches for developing features safely.
๐งน Step 9: Delete Branch
git branch -d feature-login
๐ Step 10: Check Status
git status
๐ฐ๏ธ Step 11: View Commit History
git log --oneline
Git and GitHub are essential tools for modern developers. Once you understand the flow of adding, committing, and pushing code,
you'll be able to manage projects confidently and collaborate efficiently with teams across the world.
๐งฐ Extra Useful Git Commands
Command
Description
git clone <url>Clone a GitHub repository git diffShow file changes before commit git stashTemporarily save uncommitted work git revert <commit-id>Undo a specific commit git reset --hard <commit-id>Reset repo to a previous state git tag v1.0Create a version tag git fetchGet remote changes without merging ๐งญ Example Workflow
git init
git add .
git commit -m "Initial commit"
git branch feature-login
git checkout feature-login
git add .
git commit -m "Added login feature"
git checkout main
git merge feature-login
git push origin main
๐ Conclusion



