Welcome to the cloud side of Git 🌩️ —
this is where your local work becomes global, sharable, and team-ready. 💻🌍
If Git is your personal diary, then GitHub is your public library 📚 —
you can showcase your work, collaborate with others, and back up your projects securely.
Now you have your own developer identity online!
💡 Pro Tip: Choose a clean username — it becomes part of your public URL, like
https://github.com/maheshshukla1
Once logged in:
my-first-git-projectGitHub will show a page with setup instructions 👇
We’ll use those in the next step.
git remote add origin — Linking Local Repo to GitHubNow let’s connect your local project to GitHub’s cloud.
git remote add origin https://github.com/<username>/<repo-name>.git
git remote add origin https://github.com/maheshshukla1/my-first-git-project.git
This tells Git:
“Hey, that GitHub repo is now my origin — my home base online.”
git remote -v
Output:
origin https://github.com/maheshshukla1/my-first-git-project.git (fetch)
origin https://github.com/maheshshukla1/my-first-git-project.git (push)
💡 Pro Tip:
You can have multiple remotes! e.g.
origin → GitHub
upstream → Forked repo source
git push — Upload Changes to GitHubgit push -u origin main
This uploads your commits from local → GitHub.
The -u flag links your local branch with the remote one,
so next time you can simply do:
git push
You just finished coding a login feature 💻
Let’s push it live:
git add .
git commit -m "Add login feature"
git push origin main
Now open your GitHub repo — boom 💥 your code’s there!
🔥 Pro Dev Tip: Always push small, tested commits — easier to debug and revert.
git pull — Get Latest UpdatesIf you’re collaborating with others, your teammates may have pushed new commits.
Use git pull to sync your local codebase.
git pull origin main
This does two things:
Downloads new commits
Merges them into your current branch
💡 Pro Tip:
If you want to avoid automatic merging, use git fetch instead (see below 👇).
git fetch — The Difference from Pullgit fetch only downloads changes from GitHub, but does not merge them automatically.
git fetch origin
Then you can inspect what changed:
git log origin/main
When you’re ready to merge:
git merge origin/main
🧠 Think of it like this:
git fetch → “Tell me what’s new.”
git pull → “Bring me the new stuff and merge it.”
git clone — Copy a RepositoryCloning is how you download a repo and start working instantly.
git clone https://github.com/<username>/<repo-name>.git
Example:
git clone https://github.com/maheshshukla1/GitHub-Guru.git
Now you’ve got a full copy with history, commits, and branches intact.
Let’s simulate a developer workflow 👇
# Step 1: Create local repo
git init my-portfolio
cd my-portfolio
# Step 2: Add and commit changes
git add .
git commit -m "Initial project setup"
# Step 3: Create GitHub repo and link
git remote add origin https://github.com/maheshshukla1/my-portfolio.git
# Step 4: Push to GitHub
git push -u origin main
# Step 5: Fetch and Pull updates
git fetch origin
git pull origin main
✅ You’ve just set up a professional Git workflow like a real dev team!
| Command | Direction | Analogy |
|---|---|---|
git push |
Local → Remote | Upload your code |
git pull |
Remote → Local | Download + merge |
git fetch |
Remote → Local (no merge) | Preview changes |
git clone |
Remote → Local (full copy) | Download project starter |
Always pull before you push ⚖️
Commit small & frequent changes
Use SSH instead of HTTPS for long-term projects
Keep main protected — use branches for experiments
Add .gitignore to skip unwanted files (like node_modules/)
If you’re tired of entering passwords, set up SSH keys 👇
ssh-keygen -t ed25519 -C "your_email@example.com"
cat ~/.ssh/id_ed25519.pub
Go to GitHub → Settings → SSH and GPG keys → Add New Key
Paste your key and save
Test it: ``
ssh -T git@github.com
✅ You’re now connected securely without password prompts.
✅ You created a GitHub account
✅ You linked your local repo using git remote add origin
✅ You learned push, pull, fetch, and clone
✅ You can now collaborate globally like a pro 🌍
| Git Concept | Real-World Example |
|---|---|
| Local Repo | Your Laptop |
| Remote Repo | GitHub Cloud |
push |
Upload homework |
pull |
Download new updates |
fetch |
Peek before downloading |
clone |
Copy entire project folder |
You’ll master:
rebase,stash,reset, andrevert— the ultimate developer tools to fix, rewrite, and clean history like a pro.
👉 Continue → 05-Advanced-Git
✍️ Written with ❤️ by Mahesh Shukla — connecting code across the cloud, one push at a time. ☁️