Recall Feynman Explanation (12-saal ke bachche ko samjhao)
Socho tum ek magic notebook mein ek kahani likh rahe ho. Har baar jab tum ek chapter khatam karte ho, tum ek button daba sakte ho jiska naam hai "Save Checkpoint" (ye ek commit hai). Magic notebook har checkpoint yaad rakhti hai jo tumne kabhi bhi dabaaya.
Agar tum kuch likhte ho aur baad mein pasand nahi aata, tum kisi bhi purani checkpoint pe wapas ja sakte ho aur wahan se phir se shuru kar sakte ho. Tumhara purana kaam kabhi nahi jaata!
Ab, maan lo tum apni kahani ke liye ek alag ending try karna chahte ho. Tum ek branch create karte ho—ye tumhari kahani ke liye ek parallel universe jaisi hai. Is branch mein, hero alag tarike se jeetta hai. Main kahani mein, sab same rehta hai. Baad mein, agar nayi ending pasand aaye, tum use main kahani mein merge kar sakte ho.
Tumhare dost ke paas bhi magic notebook ki ek copy hai (unke computer pe). Jab tum dono changes karte ho, tum apne checkpoints ek shared cloud notebook (GitHub) pe push karte ho, aur tum unke checkpoints pull karte ho dekhne ke liye ki unhone kya likha. Agar tum dono ne ek hi sentence change kiya, toh tumhare paas ek conflict hai—tumhe decide karna hoga kiska version rakhna hai.
Yahi hai Git! Ye tumhare code ke liye time machine + parallel universes + cloud sharing hai.
Working directory se changes ko staging area mein stage karta hai, unhe next commit mein include karne ke liye mark karta hai.
Git mein commit kya hai?
Ek specific time pe project ka snapshot, ek SHA-1 hash se identify kiya gaya, jisme author info, timestamp, message, aur parent commit(s) ki taraf pointer hota hai.
Git mein branch kya hai?
Ek commit ki taraf ek movable pointer, jo development ki ek independent line represent karta hai. Sirf 41 bytes jo ek commit hash reference karti hai.
git fetch aur git pull mein kya difference hai? :: git fetch remote changes bina merge kiye download karta hai; git pull fetch + merge automatically karta hai.
.gitignore file kyun use karte hain?
Git ko auto-generated files, large datasets, secrets, aur environment-specific files track karne se rokne ke liye jo version control mein nahi honi chahiye.
git checkout -b feature-x kya karta hai?
"feature-x" naam ki ek nayi branch create karta hai aur ek command mein uspe switch karta hai (git branch + git checkout ka shorthand).
Merge commit kya hota hai?
Ek commit jiske do (ya zyada) parent commits hote hain, tab create hota hai jab aise branches merge ki jaati hain jo diverge ho gayi hों—dono branches ke changes combine karta hai.
Git mein HEAD kis taraf point karta hai?
Current branch reference ya commit jispe tum kaam kar rahe ho. Decide karta hai ki nayi commits kahan add hongi.
Feature branches kyun use karte hain?
Experimental kaam ko stable main branch se isolate karne ke liye, parallel development enable karte hue bina production code break kiye.
Commit messages ka kya purpose hai?
Document karna kya change hua aur kyun, history ko searchable banata hai aur future developers ko codebase ka evolution samajhne mein help karta hai.
Git commits efficiently kaise store karta hai?
Commits ke beech sirf differences (deltas) store karke, full file copies nahi, content-addressable storage use karke.
Fast-forward merge kya hota hai?
Jab target branch diverge nahi hui ho, Git simply branch pointer aage move karta hai merge commit create karne ki jagah.
git push origin main kya karta hai?
Local commits ko main branch se "origin" naam ke remote repository pe bhejtaa hai aur remote branch pointer update karta hai.
ML projects mein tags kyun useful hain?
Ye specific commits ko significant mark karte hain (e.g., production models), tag checkout karke ek model version ki exact reproduction enable karte hain.