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

Git First Repository

एक repository एक school project folder जैसा है जिसके अंदर एक secret notebook tucked है, जहाँ Git अब तक किया गया हर change लिखता है। ऊपर से सब कुछ normal दिखता है, लेकिन hidden notebook history रखती है।
Syntax
bash
mkdir project_folder
cd project_folder
git init

एक Git Repository क्या है?

एक Git repository बस एक normal folder plus एक hidden subfolder, .git, है, जहाँ Git actually पूरा tracking database store करता है -- हर commit, branch pointer, और history का piece उस एक directory के अंदर रहता है, everyday work के दौरान invisible।

उदाहरण: What is a Git Repository?

bash
git init
ls -la

एक Project Folder बनाना

कुछ भी track करने से पहले, आपको काम करने के लिए एक clean folder चाहिए: mkdir my-project इसे बनाता है और cd my-project आपके terminal को इसके अंदर ले जाता है, Git को बिना किसी unrelated files के confuse किए एक empty starting point देते हुए।

उदाहरण: Creating a Project Folder

bash
mkdir my-project
cd my-project

Folder में Git Initialize करना

उस folder के अंदर git init चलाना वह एक command है जो actually एक plain directory को एक Git repository में बदल देता है -- यह hidden .git database बनाता है और कुछ और नहीं, इसलिए आपकी मौजूदा files पूरी तरह untouched रहती हैं।

उदाहरण: Initializing Git in the Folder

bash
git init

अपनी पहली File बनाना

tracking active होने पर, Git को actually track करने के लिए कुछ बनाएँ -- project explain करने वाली एक README.md, या एक simple HTML page -- क्योंकि एक empty repository के पास अभी commit करने के लिए कुछ meaningful नहीं है।

उदाहरण: Creating Your First File

bash
echo "# My Project" > README.md

Hidden .git Folder Verify करना

ls -la चलाना (all के लिए extra -a ध्यान दें, जो hidden files reveal करता है) आपको confirm करने देता है कि .git folder really exist करता है; अगर यह missing है, git init या तो fail हुआ या गलत directory में चलाया गया।

उदाहरण: Verifying the Hidden .git Folder

bash
ls -la
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. गलत folder में git init चलाना, जैसे आपकी home directory, ताकि Git इसके अंदर हर चीज़ track करने की कोशिश करे।
  2. पहले से एक repository वाले folder के अंदर या किसी दूसरी repository के अंदर दोबारा git init चलाना, एक nested .git बनाते हुए।
  3. hidden .git folder को delete या edit करना, जो repository की पूरी history destroy कर देता है।
🔒

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.