Git & GitHub — Cheatsheet
🔖
সব important commands এক জায়গায়। Bookmark করো, print করো, দেওয়ালে লাগাও।
Setup (একবার করলেই হয়)
git --version # Git installed কিনা check করো
git config --global user.name "Your Name" # তোমার নাম set করো
git config --global user.email "you@example.com" # তোমার email set করো
git config --global init.defaultBranch main # Default branch নাম
git config --list # সব config দেখোProject শুরু করা
git init # নতুন repo শুরু করো
git clone git@github.com:user/repo.git # GitHub থেকে clone করো
git remote -v # Remote connections দেখো
git remote add origin git@github.com:user/repo.git # Remote add করো
git remote set-url origin git@github.com:user/repo.git # Remote URL change করোDaily Workflow
git status # কী কী changed দেখো
git add filename.txt # Specific file stage করো
git add . # সব changes stage করো
git restore --staged filename.txt # Stage থেকে বাদ দাও
git commit -m "Your message here" # Commit করো
git push # GitHub-এ upload করো
git push -u origin main # প্রথমবার push (branch set করে)
git pull # GitHub থেকে latest নামাও
git fetch origin # Download করো, apply করো নাBranching
git branch # Local branches দেখো
git branch -a # সব branches দেখো (remote সহ)
git switch branch-name # Branch-এ যাও
git switch -c feature/new-feature # নতুন branch বানাও এবং যাও
git branch -d branch-name # Branch delete করো (merged)
git branch -D branch-name # Branch force delete করো
git push origin --delete branch-name # Remote branch delete করো
git fetch --prune # Deleted remote branches clean করোMerging
git merge branch-name # Branch merge করো
git merge origin/main # Remote main merge করো
git merge --abort # Merge cancel করো (conflict-এ)Stash
git stash # Current changes সরিয়ে রাখো
git stash pop # Stash ফিরিয়ে আনো
git stash list # সব stash দেখো
git stash apply stash@{1} # Specific stash apply করো
git stash drop # Latest stash delete করো
git stash clear # সব stash delete করোHistory দেখা
git log # Full commit history
git log --oneline # Short history
git log --oneline --graph # Branch tree সহ history
git log --author="Name" # নির্দিষ্ট কারো commits
git log --since="2 weeks ago" # নির্দিষ্ট সময়ের commits
git diff # Unstaged changes দেখো
git diff --staged # Staged changes দেখো
git show a1b2c3d # Specific commit দেখোUndo করা
Commit করার আগে
git restore filename.txt # File-এর changes undo করো
git restore --staged filename.txt # Unstage করোreset --hardসাবধানে — changes permanently মুছে যায়।- Push করার পর
resetকরবে না —revertব্যবহার করো।
Tags (Version Marking)
git tag # সব tags দেখো
git tag -a v1.0.0 -m "First release" # Annotated tag বানাও
git push origin v1.0.0 # Tag GitHub-এ push করো
git push origin --tags # সব tags push করোFork Workflow
# Fork clone করার পর
git remote add upstream git@github.com:original/repo.git
# Fork sync করো
git fetch upstream
git switch main
git merge upstream/main
git push origin mainHotfix Workflow (Emergency)
git switch main
git pull
git switch -c hotfix/critical-bug-fix
# fix করো
git add .
git commit -m "Fix critical bug"
git switch main
git merge hotfix/critical-bug-fix
git push
git tag -a v1.0.1 -m "Hotfix: critical bug"
git push origin v1.0.1
git switch develop
git merge hotfix/critical-bug-fix
git push
git branch -d hotfix/critical-bug-fixCommit Message Guide
Types
| Type | কখন |
|---|---|
feat: | নতুন feature |
fix: | Bug fix |
docs: | Documentation |
style: | Formatting (code logic change না) |
refactor: | Code restructure |
chore: | Dependency update, config change |
উদাহরণ
feat: add price filter to product listing
fix: resolve login redirect on Safari
docs: update README with installation steps
chore: update npm dependenciesBranch Naming Guide
feature/short-description → নতুন feature
fix/short-description → Bug fix
hotfix/short-description → Emergency live fix
docs/short-description → Documentation
chore/short-description → Cleanup, updatePanic Situations & Fixes
ভুল branch
“আমি ভুল branch-এ commit করেছি!“
git reset HEAD~1 # Commit undo করো
git switch correct-branch # সঠিক branch-এ যাও
git add .
git commit -m "Your message"Complete Daily Workflow (মুখস্থ করো)
Last updated on