Git History और Features
In this page:
Git का History
Linus Torvalds ने 2005 में Git लिखा जब Linux kernel team ने अपने पिछले proprietary tool का access खो दिया, और उन्हें कुछ ऐसा चाहिए था जो तेज़, tampering के against secure, और शुरू से पूरी तरह distributed हो। पूरा system मुख्य रूप से C में supporting shell scripts के साथ बना है, convenience features से ज़्यादा raw speed को prioritize करते हुए।
उदाहरण: History of Git
git init
Speed और Performance
क्योंकि लगभग हर Git operation -- history देखना, files diff करना, एक branch बनाना -- एक remote server के बजाय आपकी local disk से पढ़ता है, आपको धीमा करने वाला कोई network round-trip नहीं है। वह local-first design cookiescursor.com जैसे platforms पर बड़ी teams को एक धीमे connection पर भी productive रखती है।
उदाहरण: Speed and Performance
git log
SHA-1 के साथ Data Integrity
Git में हर file, directory tree, और commit एक SHA-1 hash से identify होता है: इसके exact contents से compute किया गया एक 40-character fingerprint। एक byte भी बदलें और hash पूरी तरह बदल जाता है, जिसका मतलब है कि Git आपके project की पूरी history में किसी भी silent corruption या tampering detect कर सकता है।
उदाहरण: Data Integrity with SHA-1
git hash-object file.txt
Lightweight Branching Model
एक Git branch आपके project की पूरी copy नहीं है -- यह बस एक 41-byte file है जो इस समय इसके point करने वाले commit का hash रखती है। यही वजह है कि दर्जनों branches बनाना, switch करना, या merge करना heavier version control systems के उलट time या disk space में लगभग कुछ भी cost नहीं करता।
उदाहरण: Lightweight Branching Model
git branch feature-x
cat .git/refs/heads/feature-x
Staging Area
Staging area (जिसे index भी कहते हैं) आपकी working files और आपकी permanent history के बीच बैठता है, एक prep table जैसा act करते हुए जहाँ आप exactly चुनते हैं कि कौन से changes अगली commit में जाएँ। यह आपको एक साथ कई unrelated चीज़ें edit करने पर भी एक clean, focused commit बनाने देता है।
उदाहरण: The Staging Area
git add file.txt
git status
- यह मानना कि एक commit सिर्फ diff store करता है, जबकि Git project का एक snapshot store करता है और इसे एक SHA-1 hash से identify करता है।
- यह मान लेना कि Git GitHub ने बनाया, जबकि Linus Torvalds ने इसे 2005 में Linux kernel development के लिए बनाया।
- यह सोचना कि history में एक बदली गई file को उसका hash बदले बिना edit किया जा सकता है, जबकि किसी भी content को बदलना SHA-1 और इसलिए commit ID बदल देता है।
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: