← Back to Git Course | Chapter 1: Introduction & Setup | Lesson 2 of 7

Git History और Features

Git को Linux के maker ने बनाया था क्योंकि उनकी team ने अपना पुराना tool खो दिया था और वह एक तेज़, free tool चाहते थे। यह किसी का toolbox छीन लिए जाने के बाद एक बेहतर toolbox बनाने जैसा है।

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

bash
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

bash
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

bash
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

bash
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

bash
git add file.txt
git status
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. यह मानना कि एक commit सिर्फ diff store करता है, जबकि Git project का एक snapshot store करता है और इसे एक SHA-1 hash से identify करता है।
  2. यह मान लेना कि Git GitHub ने बनाया, जबकि Linus Torvalds ने इसे 2005 में Linux kernel development के लिए बनाया।
  3. यह सोचना कि 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:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.