They are not the same!
Analogy: Git is like writing a book on your laptop. GitHub is like publishing it in a library.
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git init
git clone <url>
After git init, connect your local repo to GitHub:
git remote add origin <repo-url>
git add .
git commit -m "Initial commit"
git push -u origin main
-u sets upstream tracking for future pushes
Data flows between these three areas:
git add ↓git commit ↓git status
git add <file>
git commit -m "message"
The Shopping Cart Analogy:
git add is putting items into your cart. You can still add more or put some back.git commit is checking out and paying. You get a receipt, and the transaction is final.This lets you group related changes precisely before saving them.

A parallel version of your repository. It lets you work on different things at the same time without interfering with each other.
git branch feature-login
git checkout feature-login
git checkout -b feature-login
Taking changes from one branch and incorporating them into another.
To merge feature-branch into main:
git checkout main
git merge feature-branch
On teams, we usually use Pull Requests (PRs) on GitHub instead of manual local merges.
Git is smart, but not magic. Conflicts happen when:
Git stops and asks you: "Which one do you want?"
1. Open the conflicted file. Git marks the troublesome area:
<<<<<<< HEAD (Current Change)
This is the code on your current branch.
=======
This is the incoming code from the merge.
>>>>>>> feature-branch (Incoming Change)
2. Manually delete the markers and keep the code you want.
Once the file looks correct:
git add <resolved-file>
git commit
git rebase main (run while on feature branch)
Merge: Creates a merge commit, preserves full history.
Rebase: Creates a linear history, rewrites commits.
Useful when you aren't ready to commit but need a clean working directory to switch branches.
git stash
git stash list
git stash pop
.gitignore properly. Don't commit passwords, huge files, or build folders.A standard for commit messages:
To learn more click below:
Conventional Commits Cheatsheet
git config --global user.name "Your Name"git config --global user.email "you@example.com"git --versiongit initgit clone <url>git remote add origin <url>git statusgit add <file> or git add .git commit -m "message"git loggit pushgit push -u origin maingit pullgit fetchgit branchgit branch <branch-name>git checkout <branch-name>git checkout -b <branch-name>git branch -d <branch-name>git merge <branch-name>git rebase <branch-name>git add <resolved-file>git stashgit stash listgit stash popgit stash applygit stash dropgit reset <file>git reset --hardgit checkout -- <file>git revert <commit>